diff --git a/README.md b/README.md index e8c4ca7..96bef95 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,8 @@ A script that wraps the pushover API for sending notifications. [Here](https://learningunix.net/posts/dead-simple-notifications-with-pushover/) is an article on example usage. It relies on the user's pushover user and api key to be saved as environment variables. + +## pass-menu.sh +Pipe the password store entries into wofi to create a selectable menu. +Depends on wofi, pass, and wl-clipboard. Kilpper was fighing me when +clearing the clipboard so the dbus6 line was added. diff --git a/pass-menu.sh b/pass-menu.sh new file mode 100755 index 0000000..ac0b624 --- /dev/null +++ b/pass-menu.sh @@ -0,0 +1,27 @@ +#!/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 + +) &