diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-22 12:47:15 +0200 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-22 12:47:15 +0200 | 
| commit | 3278aefffe652f1c1a5502da3fbc581ee988b3e0 (patch) | |
| tree | 46cc89bbd9cfa58dbead08d8b216e6f0a226f98c /bin/guiscripts | |
| parent | 470eb5aedd12ea922ed9e5458c3948d515164c48 (diff) | |
added wayland/MENUCMD support to dmemoji
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  | 
