summaryrefslogtreecommitdiff
path: root/.local/bin/dmenu/dm-pass
diff options
context:
space:
mode:
authoradam <56338480+adastx@users.noreply.github.com>2022-11-05 18:53:30 +0100
committeradam <56338480+adastx@users.noreply.github.com>2022-11-05 18:53:30 +0100
commit48ec52b47674cd8767ebacfb4d0b9b9c846c7446 (patch)
tree810c32e69069c7b09faf058c4f1e0818ede5ea7c /.local/bin/dmenu/dm-pass
parent145ab8f0429030edcdc86f48277508720345d167 (diff)
fixed some bindings, switched from rofi to dmenu
Diffstat (limited to '.local/bin/dmenu/dm-pass')
-rwxr-xr-x.local/bin/dmenu/dm-pass24
1 files changed, 24 insertions, 0 deletions
diff --git a/.local/bin/dmenu/dm-pass b/.local/bin/dmenu/dm-pass
new file mode 100755
index 0000000..5420549
--- /dev/null
+++ b/.local/bin/dmenu/dm-pass
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+DMENU_CMD="dmenu -p 'Pass:' -b -i -fn 'JetBrainsMono Nerd Font:size=11'"
+
+entry=$(find "$PASSWORD_STORE_DIR" -name '*.gpg' |\
+ sed "s|$PASSWORD_STORE_DIR/||" |\
+ sed "s|.gpg||" |\
+ sort -n |\
+ eval "$DMENU_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 "$DMENU_CMD")" in
+ autotype)
+ xdotool type "$user"
+ xdotool key Tab
+ xdotool type "$pass" ;;
+ pass)
+ xdotool type "$pass" ;;
+ user)
+ xdotool type "$user" ;;
+esac