From 1e267c52240e177f635f8f718099571e24493088 Mon Sep 17 00:00:00 2001 From: Justine Smithies Date: Tue, 17 Dec 2024 18:37:56 +0000 Subject: Converted from bash to sh. --- .local/bin/emoji-menu | 19 ------------------- .local/bin/emoji-menu.sh | 19 +++++++++++++++++++ .local/bin/powermenu | 37 ------------------------------------- .local/bin/powermenu.sh | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 56 deletions(-) delete mode 100755 .local/bin/emoji-menu create mode 100755 .local/bin/emoji-menu.sh delete mode 100755 .local/bin/powermenu create mode 100755 .local/bin/powermenu.sh (limited to '.local/bin') diff --git a/.local/bin/emoji-menu b/.local/bin/emoji-menu deleted file mode 100755 index 6b20513..0000000 --- a/.local/bin/emoji-menu +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -eu -# From: https://git.sr.ht/~emersion/dotfiles/tree/6575f89856d012c2c31e9e7d2c807f350c7503d4/item/bin/emoji-menu -# This version uses `fuzzel` instead of `menu`. - -default_cache_home=~/.cache -cache_home="${XDG_CACHE_HOME:-$default_cache_home}" -mkdir -p "$cache_home" -data_file="$cache_home/emoji-menu.json" - -if ! [ -f "$data_file" ]; then - curl -o "$data_file" -L "https://github.com/github/gemoji/raw/master/db/emoji.json" -fi - -filter='.[] | (.emoji + " " + .description + " (" + (.aliases | join(", ")) + ")")' -sel="$(jq -r "$filter" <"$data_file" | fuzzel --no-exit-on-keyboard-focus-loss -d | cut -d ' ' -f 1 | tr -d '\n')" -if [ -n "$sel" ]; then - # wl-ime-type "$sel" - wl-copy "$sel" -fi diff --git a/.local/bin/emoji-menu.sh b/.local/bin/emoji-menu.sh new file mode 100755 index 0000000..6b20513 --- /dev/null +++ b/.local/bin/emoji-menu.sh @@ -0,0 +1,19 @@ +#!/bin/sh -eu +# From: https://git.sr.ht/~emersion/dotfiles/tree/6575f89856d012c2c31e9e7d2c807f350c7503d4/item/bin/emoji-menu +# This version uses `fuzzel` instead of `menu`. + +default_cache_home=~/.cache +cache_home="${XDG_CACHE_HOME:-$default_cache_home}" +mkdir -p "$cache_home" +data_file="$cache_home/emoji-menu.json" + +if ! [ -f "$data_file" ]; then + curl -o "$data_file" -L "https://github.com/github/gemoji/raw/master/db/emoji.json" +fi + +filter='.[] | (.emoji + " " + .description + " (" + (.aliases | join(", ")) + ")")' +sel="$(jq -r "$filter" <"$data_file" | fuzzel --no-exit-on-keyboard-focus-loss -d | cut -d ' ' -f 1 | tr -d '\n')" +if [ -n "$sel" ]; then + # wl-ime-type "$sel" + wl-copy "$sel" +fi diff --git a/.local/bin/powermenu b/.local/bin/powermenu deleted file mode 100755 index e1896b1..0000000 --- a/.local/bin/powermenu +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -read -r wallpaper<~/.cache/wallpaper - -#### Options ### -power_off=" Shutdown" -reboot="󰜉 Reboot" -lock_screen=" Lock Screen" -suspend=" Suspend" -hibernate="󰒲 Hibernate" -log_out="󰍃﫼 Log Out" - -# Options passed to fuzzel -options="$power_off\n$reboot\n$suspend\n$hibernate\n$log_out\n$lock_screen" -lines="$(echo "$options" | grep -oF '\n' | wc -l)" -rofi_command="fuzzel -d -w 14 -l $((lines+1))" -chosen="$(echo -e "$options" | $rofi_command )" -case $chosen in - "$lock_screen") - swaylock -f -i "$wallpaper" - ;; - "$power_off") - doas poweroff - ;; - "$reboot") - doas reboot - ;; - "$suspend") - # $lock && loginctl suspend - ;; - "$hibernate") - # $lock && loginctl hibernate - ;; - "$log_out") - riverctl exit - ;; -esac diff --git a/.local/bin/powermenu.sh b/.local/bin/powermenu.sh new file mode 100755 index 0000000..8d353c2 --- /dev/null +++ b/.local/bin/powermenu.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +read -r wallpaper<~/.cache/wallpaper + +#### Options ### +power_off=" Shutdown" +reboot="󰜉 Reboot" +lock_screen=" Lock Screen" +suspend=" Suspend" +hibernate="󰒲 Hibernate" +log_out="󰍃 Log Out" + +# Options passed to fuzzel +options="$power_off\n$reboot\n$suspend\n$hibernate\n$log_out\n$lock_screen" +lines="$(echo "$options" | grep -oF '\n' | wc -l)" +rofi_command="fuzzel -d -w 14 -l $((lines+1))" +chosen="$(echo -e "$options" | $rofi_command )" +case $chosen in + "$lock_screen") + swaylock -f -i "$wallpaper" + ;; + "$power_off") + doas poweroff + ;; + "$reboot") + doas reboot + ;; + "$suspend") + # $lock && loginctl suspend + ;; + "$hibernate") + # $lock && loginctl hibernate + ;; + "$log_out") + riverctl exit + ;; +esac -- cgit v1.2.3