From 3278aefffe652f1c1a5502da3fbc581ee988b3e0 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sat, 22 Apr 2023 12:47:15 +0200 Subject: added wayland/MENUCMD support to dmemoji --- bin/guiscripts/dmemoji | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'bin/guiscripts') 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 copied!" - 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 copied!" + echo -n "$input" | $copycmd + fi + ;; + "") + sh $0 list | $menucmd | sh $0 copy + ;; esac exit -- cgit v1.2.3