summaryrefslogtreecommitdiff
path: root/.local/bin/menu/pass
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/menu/pass')
-rwxr-xr-x.local/bin/menu/pass24
1 files changed, 24 insertions, 0 deletions
diff --git a/.local/bin/menu/pass b/.local/bin/menu/pass
new file mode 100755
index 0000000..86fd1ee
--- /dev/null
+++ b/.local/bin/menu/pass
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+MENU_CMD="bemenu -p 'pass'"
+
+entry=$(find "$PASSWORD_STORE_DIR" -name '*.gpg' |\
+ sed "s|$PASSWORD_STORE_DIR/||" |\
+ sed "s|.gpg||" |\
+ sort -n |\
+ eval "$MENU_CMD") || exit 1
+
+details=$(pass "$entry") || exit 1
+user=$(echo "$details" | sed -n '2p' | sed 's|user: ||')
+pass=$(echo "$details" | head -n1)
+
+case "$(printf "autotype\npass\nuser" | eval "$MENU_CMD")" in
+ autotype)
+ wtype "$user"
+ wtype -k Tab
+ wtype "$pass" ;;
+ pass)
+ wtype "$pass" ;;
+ user)
+ wtype "$user" ;;
+esac