Created
August 4, 2017 05:22
-
-
Save jyc/910731e79730a55244b3e9563af85cf8 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 ⏱ | |
| ) | |
| 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 | |
| echo "Nothing selected." | |
| exit 1 | |
| fi | |
| echo -n "$snippet" | xclip | |
| xdotool click 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment