From 8aeb485b857beef0e104707dd269bdb70d95e56e Mon Sep 17 00:00:00 2001 From: samedamci Date: Mon, 11 May 2020 15:24:21 +0200 Subject: [PATCH] Small modifications in 'fawesome' and 'unicode' scripts --- .local/bin/scripts/fawesome | 11 ++++++----- .local/bin/scripts/unicode | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.local/bin/scripts/fawesome b/.local/bin/scripts/fawesome index 9ec03cb..5d4da95 100755 --- a/.local/bin/scripts/fawesome +++ b/.local/bin/scripts/fawesome @@ -2,13 +2,14 @@ xclip -h 2>/dev/null || exit -CHOSEN=$(sed '0,/^__DATA__$/d' "$0" | rofi -dmenu -i -l 20 -p 'Font Awesome') +emoji=$(sed '0,/^__DATA__$/d' "$0" | rofi -dmenu -i -l 20 -p 'Font Awesome') +[ ! "$emoji" ] && exit -[ "$CHOSEN" != "" ] || exit +emoji=$(printf "%s$emoji" | sed "s/ .*//") -CHOSEN=$(printf "%s$CHOSEN" | sed "s/ .*//") -echo "$CHOSEN" | tr -d '\n' | xclip -selection clipboard -notify-send "'$CHOSEN' copied to clipboard." +echo "$emoji" | tr -d '\n' | xclip -selection clipboard + +notify-send "'$emoji' copied to clipboard." exit diff --git a/.local/bin/scripts/unicode b/.local/bin/scripts/unicode index 6a95a48..03d8a8a 100755 --- a/.local/bin/scripts/unicode +++ b/.local/bin/scripts/unicode @@ -1,16 +1,17 @@ #!/usr/bin/env sh + # Give dmenu list of all unicode characters to copy. # Shows the selected character in dunst if running. xclip -h 2>/dev/null || exit -CHOSEN=$(sed '0,/^__DATA__$/d' "$0" | rofi -dmenu -i -l 20 -p 'Unicode') +emoji=$(sed '0,/^__DATA__$/d' "$0" | rofi -dmenu -i -l 20 -p 'Unicode') -[ "$CHOSEN" != "" ] || exit +[ ! "$emoji" ] && exit -CHOSEN=$(printf "%s$CHOSEN" | sed "s/ .*//") -echo "$CHOSEN" | tr -d '\n' | xclip -selection clipboard -notify-send "'$CHOSEN' copied to clipboard." +emoji=$(printf "%s$emoji" | sed "s/ .*//") +echo "$emoji" | tr -d '\n' | xclip -selection clipboard +notify-send "'$emoji' copied to clipboard." exit