dotfiles/bin/fzf-pass-inner.sh

17 lines
433 B
Bash
Raw Normal View History

2021-05-23 17:31:52 +02:00
set -euo pipefail
ENTRY=$(find ~/.password-store/ -name "*.gpg" -printf "%P\n" | sed -e 's/\.gpg$//' | fzf)
if [ -z "$ENTRY" ]; then
exit 1
fi
PASSENTRY=$(pass "$ENTRY")
2023-04-16 16:52:24 +02:00
builtin echo "$PASSENTRY" | head -n1 | nohup wl-copy -f -n &
WLCOPY_PID=$!
disown -h
nohup bash -c "sleep 30s; kill $WLCOPY_PID" &
disown -h
2021-05-23 17:31:52 +02:00
NOTIFICATION=$(builtin echo "$PASSENTRY" | sed 1d)
notify-send -t 6000 "$NOTIFICATION"
builtin echo "$NOTIFICATION"