aboutsummaryrefslogtreecommitdiff
path: root/bin/menu-lesspass
diff options
context:
space:
mode:
authorSamuel Fadel <samuel@nihil.ws>2023-01-19 10:04:51 +0100
committerSamuel Fadel <samuel@nihil.ws>2023-01-19 10:04:51 +0100
commit960d8647437f7127a6de167b974b8f7aafc77130 (patch)
tree3b720f775a8e329b2ff23e077fa22335fd0473aa /bin/menu-lesspass
parent0701a5dd2e309c8d51282632e9f4b5a64a55a3e0 (diff)
Added first few utilities0.1
Diffstat (limited to 'bin/menu-lesspass')
-rwxr-xr-xbin/menu-lesspass22
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/menu-lesspass b/bin/menu-lesspass
new file mode 100755
index 0000000..3abdfd0
--- /dev/null
+++ b/bin/menu-lesspass
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Search in logins list using bemenu. Assumes a .config/logins.db.asc file exists
+# with:
+# DOMAIN_1 USERNAME_1
+# DOMAIN_2 USERNAME_2
+# ...
+# DOMAIN_N USERNAME_N
+# pairs, one per line.
+
+SELECTION=`gpg --decrypt $HOME/.config/logins.db.asc 2>/dev/null | bemenu -i -s -c -l 20 -W 0.2 -p '*'`
+DOMAIN=`echo $SELECTION | cut -f 1 -d ' '`
+USERNAME=`echo $SELECTION | cut -f 2 -d ' '`
+OPTIONS=`echo $SELECTION | cut -f 1,2 -d ' ' --complement`
+
+if [ -z $USERNAME ] || [ -z $DOMAIN ]; then
+ exit 1
+fi
+
+# -c copies to clipboard
+export LESSPASS_MASTER_PASSWORD=`pass lesspass`
+lesspass $DOMAIN $USERNAME $OPTIONS -c 2>&1 >/dev/null