From b4432592d88d2080c4a86e3f05e293cbec2fa271 Mon Sep 17 00:00:00 2001 From: Marcel Robitaille Date: Thu, 18 Nov 2021 12:14:43 -0500 Subject: [PATCH] [rofi] Add rofi snippet script --- bin/snippy.sh | 15 +++++++++++++++ snippets/pubkey | 1 + xbindkeys/.xbindkeysrc | 3 +++ 3 files changed, 19 insertions(+) create mode 100755 bin/snippy.sh create mode 100755 snippets/pubkey diff --git a/bin/snippy.sh b/bin/snippy.sh new file mode 100755 index 0000000..8d47201 --- /dev/null +++ b/bin/snippy.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# Stolen from https://github.com/CalinLeafshade/dots/blob/master/bin/bin/snippy.sh +# https://www.youtube.com/watch?v=PRgIxRl67bk + +SNIPS=${HOME}/.dotfiles/snippets + +FILE=`ls ${SNIPS} | /usr/bin/rofi -dmenu` + +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 diff --git a/snippets/pubkey b/snippets/pubkey new file mode 100755 index 0000000..8f720c1 --- /dev/null +++ b/snippets/pubkey @@ -0,0 +1 @@ +command cat /home/marcel/.ssh/id_rsa.pub diff --git a/xbindkeys/.xbindkeysrc b/xbindkeys/.xbindkeysrc index 883237c..1aba6c8 100644 --- a/xbindkeys/.xbindkeysrc +++ b/xbindkeys/.xbindkeysrc @@ -16,6 +16,9 @@ "rofimoji" Mod2+Mod4 + e +"/home/marcel/.local/bin/snippy.sh" + Mod2+Mod4 + s + "nohup alacritty > /dev/null 2>&1" Mod2+Mod4 + Return