diff options
author | Justine Smithies <justine@smithies.me.uk> | 2025-06-12 18:42:35 +0100 |
---|---|---|
committer | Justine Smithies <justine@smithies.me.uk> | 2025-06-12 18:42:35 +0100 |
commit | d49d938d8cf0ed8e6b0aeef32344ff630d0c338f (patch) | |
tree | e8d4c5d7505fcba5fcaafb8902c5e033b1231f60 | |
parent | 6e30128485a63626d60cdec866a2d0ef8e39e07c (diff) |
Adapted to use rofi script mode rather than fuzzel
-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" |