Middle-click paste menu for text snippets

This commit is contained in:
John Mertz 2023-03-13 15:47:07 -04:00
parent ccf6a8e85b
commit c99674cae7
Signed by: jpm
GPG Key ID: E9C5EA2D867501AB
1 changed files with 12 additions and 0 deletions

12
snippets.sh Executable file
View File

@ -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