diff --git a/snippets.sh b/snippets.sh new file mode 100755 index 0000000..8bdf2ea --- /dev/null +++ b/snippets.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Copy snippet to primary clipboard for middle-click pasting + +# Maintain list of snippets in private repository +FOLDER=${HOME}/.private-scripts/snippets + +FILE=`ls ${FOLDER} | /usr/bin/rofi -dmenu` + +if [ -f ${FOLDER}/${FILE} ]; then + DATA=$([ -x "${FOLDER}/${FILE}" ] && bash "${FOLDER}/${FILE}" || head --bytes=-1 ${FOLDER}/${FILE}) + printf -- "${DATA}" | wl-copy -p +fi