dotfiles/.local/bin/dsnippets

13 lines
304 B
Bash
Executable File

#!/bin/bash
SNIPS=~/.local/share/snippets
FILE=`ls ${SNIPS} | dmenu -l 20`
if [ -f "${SNIPS}/${FILE}" ]; then
DATA=$([ -x "${SNIPS}/${FILE}" ] && bash "${SNIPS}/${FILE}" || head --bytes=-1 ${SNIPS}/${FILE})
printf "$DATA" | xsel -p -i
printf "$DATA" | xsel -b -i
xdotool key shift+Insert
fi