[bin] Fix gopass launcher to actually spawn in background

This commit is contained in:
Sebastian Schulze 2021-07-15 00:44:22 +02:00
parent a6079f41d1
commit 76f36c2831
No known key found for this signature in database
GPG Key ID: F6BA63C6A7D3044E
2 changed files with 16 additions and 8 deletions

View File

@ -1,18 +1,26 @@
#!/usr/bin/env bash
set -x
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.
QUERY=$1
SWAYSOCK=/run/user/$UID/sway-ipc.$UID.$(pidof sway).sock
export SWAYSOCK
if [ -z "$QUERY" ]; then
QUERY=''
fi
QUERY=''
fi
input=$(gopass list -f | fzf -q "$QUERY")
printf '%s' "$(gopass show -o "$input")" | wl-copy
swaymsg exec -- notify-send "gopass" "Copied ${input} to clipboard." -t 2000
swaymsg move scratchpad
gopass show -o "$input" | wl-copy
notify-send "gopass" "Copied ${input} to clipboard." -t 2000 --icon=dialog-password
sleep 5
wl-copy --clear
swaymsg exec -- notify-send "gopass" "Cleared clipboard" -t 1000
notify-send "gopass" "Cleared clipboard" -t 1000 --icon=dialog-password

View File

@ -17,11 +17,11 @@ then
COMMAND=~/bin/launcher-bookmarks
elif [[ "$1" == "clipboard" ]]
then
FZF_DEFAULT_OPTS="--prompt='📋 ' --algo=v1 --bind 'tab:up' --read0 ${FZF_DEFAULT_OPTS}"
FZF_DEFAULT_OPTS="--prompt='📋 ' --algo=v1 --bind 'tab:up' ${FZF_DEFAULT_OPTS}"
COMMAND=~/bin/launcher-clipboard
elif [[ "$1" == "gopass" ]]
then
FZF_DEFAULT_OPTS="--prompt='🔑 ' --algo=v1 --bind 'tab:up' --read0 ${FZF_DEFAULT_OPTS}"
FZF_DEFAULT_OPTS="--prompt='🔑 ' --algo=v1 --bind 'tab:up' ${FZF_DEFAULT_OPTS}"
COMMAND=~/bin/launcher-gopass
else
exec foot --app-id launcher --config ~/.config/foot/foot-launcher.ini ~/bin/launcher-run