diff --git a/README b/README index 545b28c..054598f 100644 --- a/README +++ b/README @@ -10,3 +10,14 @@ examples: # launch shmoji with bemenu shmoji bemenu + + # launch shmoji with fzf + shmoji fzf + + +how do i use this in... +sway/i3: + bindsym $mod+Shift+o exec --no-startup-id shmoji bemenu + +shell: + shmoji fzf diff --git a/shmoji b/shmoji index f6465d0..18bd6da 100755 --- a/shmoji +++ b/shmoji @@ -9,7 +9,7 @@ set -e cmd="$1" -emojidb="$HOME/.local/share/emoji-bemenu" +emojidb="$HOME/.local/share/shmoji" emojifile="$emojidb/emojis.txt" die() { @@ -17,6 +17,10 @@ die() { exit 1 } +emojicheck() { + [ -f "$emojifile" ] || die "emojis not found. try 'shmoji download'" +} + case "$cmd" in download) command -v curl > /dev/null || die 'curl not found' @@ -26,11 +30,18 @@ case "$cmd" in curl 'https://trash.j3s.sh/emojis.txt' >"$emojidb/emojis.txt" ;; bemenu) + emojicheck command -v bemenu > /dev/null || die 'bemenu not found' command -v wtype > /dev/null || die 'wtype not found' emoji=$(cat "$emojidb/emojis.txt" | bemenu -c -W 0.2 -l 20) printf "%s" "$emoji" | cut -d " " -f 1 | tr -d '\n' | wtype - ;; + fzf) + emojicheck + command -v fzf > /dev/null || die 'fzf not found' + emoji=$(cat "$emojidb/emojis.txt" | fzf) + printf "%s" "$emoji" | cut -d " " -f 1 | tr -d '\n' + ;; *) printf "%s\n" "usage: shmoji [bemenu | download]" ;;