diff options
Diffstat (limited to 'bin/guiscripts')
-rwxr-xr-x | bin/guiscripts/dmemoji | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/bin/guiscripts/dmemoji b/bin/guiscripts/dmemoji index 8225f12..d051ad8 100755 --- a/bin/guiscripts/dmemoji +++ b/bin/guiscripts/dmemoji @@ -5,24 +5,39 @@ # If this file includes emojis below "__DATA__" it is generated. # This file was generated: 2022-04-21 12:38:03+00:00 +if [ "$WAYLAND_DISPLAY" ] +then + copycmd="wl-copy" +else + copycmd="xclip -sel c" +fi +if [ "$MENUCMD" = "tofi" ] +then + menucmd="tofi --width 30% --height 30% --matching-algorithm normal --prompt-text Emoji:" +elif [ "$MENUCMD" = "dmenu" ] +then + menucmd="dmenu -l 20 -g 1 -x -i -p Emoji:" +else + menucmd="fzf --prompt Emoji:" +fi set -e case "$1" in - "list") - data=$(sed '0,/^__DATA__$/d' "$0") - echo "$data" - ;; - "copy") - input=$(tee) - if [ ! -z "$input" ]; then - emoji=${input::1} - echo -n "$emoji" | xclip -selection c - notify-send "dmemoji" "$emoji <b>copied!</b>" - fi - ;; - "") - sh $0 list | dmenu -x -i -g 1 -l 20 -p 'Emoji:' | sh $0 copy - ;; + "list") + data=$(sed '0,/^__DATA__$/d' "$0") + echo -n "$data" + ;; + "copy") + input=$(tee | cut -f 1 -d ' ') + if [ ! -z "$input" ] + then + notify-send "dmemoji" "$input <b>copied!</b>" + echo -n "$input" | $copycmd + fi + ;; + "") + sh $0 list | $menucmd | sh $0 copy + ;; esac exit |