snippets.sh (490B)
1 #!/bin/sh 2 3 # Can be just a file with text in it, or a script that will be executed and the output copied 4 5 DMENU_SCRIPT="$XDG_DATA_HOME/regexghost/wm-scripts/dmenu-runner.sh" 6 SNIPPETS_DIR="$XDG_DATA_HOME/regexghost/snippets" 7 8 output="$(ls "$SNIPPETS_DIR" | "$DMENU_SCRIPT" "Select Snippet:")" 9 status=$? 10 [ "$output" = "" ] && exit 11 12 file="${SNIPPETS_DIR}/${output}" 13 14 if [ -x "$file" ]; then 15 result="$("$file")" 16 else 17 result="$(cat "$file")" 18 fi 19 20 echo -n "$result" | xclip -selection clipboard