diff options
Diffstat (limited to '.local')
-rwxr-xr-x | .local/bin/emoji-menu.sh | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/.local/bin/emoji-menu.sh b/.local/bin/emoji-menu.sh index 6b20513..b4c79d0 100755 --- a/.local/bin/emoji-menu.sh +++ b/.local/bin/emoji-menu.sh @@ -1,6 +1,6 @@ -#!/bin/sh -eu +#!/bin/sh # From: https://git.sr.ht/~emersion/dotfiles/tree/6575f89856d012c2c31e9e7d2c807f350c7503d4/item/bin/emoji-menu -# This version uses `fuzzel` instead of `menu`. +# This version uses `rofi script mode` instead of `fuzzel` or 'dmenu'. default_cache_home=~/.cache cache_home="${XDG_CACHE_HOME:-$default_cache_home}" @@ -12,8 +12,13 @@ if ! [ -f "$data_file" ]; then 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" +sel="$(jq -r "$filter" <"$data_file")" + +# Copy selection to clipboard +if [ "$@" ]; then + wl-copy "$(echo -e "$@" | cut -d ' ' -f 1)" + exit 0 fi + +# Display all options in menu +echo -e "$sel" |