-
-
Save Konfekt/3c8704604e9dae5c07ef1c2fd8e2225b to your computer and use it in GitHub Desktop.
modified version of snippy that does NOT use the clipboard and works thus everywhere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# From | |
# Based on: | |
# https://github.com/BarbUk/dotfiles/blob/master/bin/snippy | |
# https://git.zx2c4.com/password-store/tree/contrib/dmenu/passmenu | |
DIR=${HOME}/.snippy | |
MENU_ENGINE="rofi" | |
DMENU_ARGS='-dmenu -i -sort -lines 25' | |
MENU_ARGS=${DMENU_ARGS} | |
cd "${DIR}" || exit | |
# Use the filenames in the snippy directory as menu entries. | |
# Get the menu selection from the user. | |
FILE=$(find -L . -type f | grep -v '^\.$' | sed 's!\.\/!!' | grep -vE '\.git/|\.gitconfig|\.gitkeep' | ${MENU_ENGINE} ${MENU_ARGS} -p '❯ ') | |
# just return if nothing was selected | |
[[ -z "${FILE}" ]] && exit | |
cat "$FILE" \ | |
| { | |
IFS= read -r LINE; | |
xdotool type -- "$LINE"; | |
while IFS= read -r LINE; do | |
xdotool key Return; | |
xdotool type -- "$LINE"; | |
done; | |
} \ | |
| xdotool type --clearmodifiers --file - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment