dotfiles/.config/niri/emoji-picker.fish

20 lines
560 B
Fish
Executable file

#!/usr/bin/env fish
argparse c/clipboard -- $argv
set -l data_path ~/.config/niri/emoji-data.txt
# read emoji data
set -l data (cat $data_path | string collect -N | string trim --right | string collect -N)
# user selects line with fuzzel
set -l line (printf "%s" $data | fuzzel --prompt=">> " --dmenu)
# get the first space-separated token
set -l emoji (string split -f1 ' ' $line)
if test -n "$emoji"
# only type emoji if user made a selection
if not set -ql _flag_c
wtype $emoji
else
wl-copy $emoji
end
else
return 1
end