scripts/snippets.sh

13 lines
397 B
Bash
Raw Normal View History

#!/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