[PATCH] passmenu.sh: pass menu to select a password to copy to clipboard
Export this patch
Signed-off-by: hazardchem <pthom44@live.com.au>
---
scripts/README.md | 5 +++++
scripts/passmenu.sh | 28 ++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
create mode 100755 scripts/passmenu.sh
diff --git a/scripts/README.md b/scripts/README.md
index 993952b..63096aa 100644
--- a/scripts/README.md
+++ b/scripts/README.md
@@ -99,3 +99,8 @@ Copy the script to `$XDG_CONFIG_HOME/sxmo/userscripts` and make it executable.
- Author: Peter Thomason <pthom44@live.com.au>
- Licence: GPL3+
- Description: Modified sxmo_websearch.sh to have a bookmarks file selection. Default location for bookmarks is ~/.config/sxmo/bookmarks.tsv
+
+## passmenu.sh
+- Author: Peter Thomason <pthom44@live.com.au>
+- Licence: GPL3+
+- Description: passmenu tailored for sxmo.
diff --git a/scripts/passmenu.sh b/scripts/passmenu.sh
new file mode 100755
index 0000000..61af32f
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Based off: https://git.zx2c4.com/password-store/tree/contrib/dmenu/passmenu
+
+dmenu=sxmo_dmenu.sh
+
+if [ -n $WAYLAND_DISPLAY ]; then
+ xdotool="ydotool type --file -"
+elif [ -n $DISPLAY ]; then
+ xdotool="xdotool type --clearmodifiers --file -"
+else
+ echo "Error: No Wayland or X11 display detected" >&2
+ exit 1
+fi
+
+if [ -n $PASSWORD_STORE_DIR ]; then
+ prefix="$HOME/.password-store"
+else
+ prefix=$PASSWORD_STORE_DIR
+fi
+
+password_files=$(tree -if $prefix | grep .gpg | sed "s|${prefix}/||" | sed 's|.gpg||')
+password=$(printf '%s' "$password_files" | awk '($0){print} END{print "Close Menu"}' | "$dmenu" -i -p "Passmenu")
+
+case "$password" in
+ "Close Menu") exit 0 ;;
+ "") exit 0 ;;
+ *) sxmo_terminal.sh pass -c "$password" ;;
+esac
--
2.38.1
Thanks! I have applied. Sorry for the late response.
--
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt