Created
August 4, 2017 05:39
-
-
Save jyc/c664ec0c96d17f411164e759c626b77f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh | |
| set -euo pipefail | |
| typeset -a SNIPPETS | |
| SNIPPETS=( | |
| note π | |
| pin π | |
| stopwatch β± | |
| fire π₯ | |
| sushi π£ | |
| broken-heart π | |
| ) | |
| local text=$( | |
| for ((i = 1; i <= ${#SNIPPETS}; i = i + 2)); do | |
| echo ${SNIPPETS[$i]} | |
| done | dmenu | |
| ) | |
| local snippet=$( | |
| for ((i = 1; i <= ${#SNIPPETS}; i = i + 2)); do | |
| if [[ "${SNIPPETS[$i]}" == $text ]]; then | |
| echo ${SNIPPETS[$i + 1]} | |
| fi | |
| done | |
| ) | |
| if [[ -z "$snippet" ]]; then | |
| notify-send "Didn't recognize text '$text'." | |
| exit 1 | |
| fi | |
| echo -n "$snippet" | xclip | |
| #echo -n "$snippet" | iconv -f UTF8 -t UTF16 | xvkbd -utf -file - | |
| # Send a middle click. Can be wrong sometimes. | |
| #xdotool click 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment