dotfiles/bin/executable_launcher-gopass

27 lines
616 B
Plaintext
Raw Normal View History

2021-06-10 09:40:35 +02:00
#!/usr/bin/env bash
set -o errexit
# Select a password from the gopass store,copy it to current primary clipboard,
# send the current terminal window to the scratch space & clear the clipboard
# afterwards.
2021-06-10 09:40:35 +02:00
QUERY=$1
SWAYSOCK=/run/user/$UID/sway-ipc.$UID.$(pidof sway).sock
export SWAYSOCK
if [ -z "$QUERY" ]; then
QUERY=''
fi
2021-06-10 09:40:35 +02:00
input=$(gopass list -f | fzf -q "$QUERY")
swaymsg move scratchpad
gopass show -o "$input" | wl-copy
notify-send "gopass" "Copied ${input} to clipboard." -t 2000 --icon=dialog-password
2021-06-10 09:40:35 +02:00
sleep 5
wl-copy --clear
notify-send "gopass" "Cleared clipboard" -t 1000 --icon=dialog-password