28 lines
582 B
Bash
Executable File
28 lines
582 B
Bash
Executable File
#!/bin/sh
|
|
|
|
deps="wofi pass wl-copy"
|
|
|
|
for dep in $deps; do
|
|
command -v $dep >/dev/null 2>&1 || {
|
|
echo "error: $dep is not installed" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
store="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
|
|
|
passwords="$(find "$store" -name "*.gpg" | sed -e 's|\.gpg$||' | sed -e "s|$store/||")"
|
|
|
|
selection=$(echo "$passwords" | wofi --dmenu)
|
|
|
|
[ -z "$selection" ] && exit 0
|
|
|
|
pass show "$selection" | head -n 1 | wl-copy
|
|
|
|
(
|
|
sleep 15
|
|
wl-copy --clear
|
|
command -v qdbus6 >/dev/null 2>&1 && qdbus6 org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory
|
|
|
|
) &
|