2024-05-15 00:53:36 +02:00
|
|
|
{ pkgs }:
|
|
|
|
|
|
|
|
pkgs.writeShellScriptBin "emopicker9000" ''
|
2024-05-24 07:14:25 +02:00
|
|
|
# Get user selection via wofi from emoji file.
|
|
|
|
chosen=$(cat $HOME/.config/.emoji | ${pkgs.rofi-wayland}/bin/rofi -i -dmenu -config ~/.config/rofi/config-emoji.rasi | awk '{print $1}')
|
2024-05-15 00:53:36 +02:00
|
|
|
|
2024-05-24 07:14:25 +02:00
|
|
|
# Exit if none chosen.
|
|
|
|
[ -z "$chosen" ] && exit
|
2024-05-15 00:53:36 +02:00
|
|
|
|
2024-05-24 07:14:25 +02:00
|
|
|
# If you run this command with an argument, it will automatically insert the
|
|
|
|
# character. Otherwise, show a message that the emoji has been copied.
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
${pkgs.ydotool}/bin/ydotool type "$chosen"
|
|
|
|
else
|
|
|
|
printf "$chosen" | ${pkgs.wl-clipboard}/bin/wl-copy
|
|
|
|
${pkgs.libnotify}/bin/notify-send "'$chosen' copied to clipboard." &
|
|
|
|
fi
|
2024-05-15 00:53:36 +02:00
|
|
|
''
|