summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2023-12-19 10:44:47 -0500
committerAdam T. Carpenter <atc@53hor.net>2023-12-19 10:44:47 -0500
commit8631335ebd045a374d7e57d36c8023ff446eec8d (patch)
tree6e29c91f422585285c1df6abaec18aa0065b5bbc
parentea32298b5db6b5f720ad6f053cb3e4b7eca2853a (diff)
downloadscripts-8631335ebd045a374d7e57d36c8023ff446eec8d.tar.xz
scripts-8631335ebd045a374d7e57d36c8023ff446eec8d.zip
feat: better rofi pass using builtin script apiHEADmaster
Simple Rofi pass acts as a modi for otp or pass selection
-rwxr-xr-xpassmenu.sh43
-rwxr-xr-xrofi-pass.sh31
2 files changed, 31 insertions, 43 deletions
diff --git a/passmenu.sh b/passmenu.sh
deleted file mode 100755
index a7bd8cb..0000000
--- a/passmenu.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-prefix=${PASSWORD_STORE_DIR:-~/.password-store}
-
-get_password() {
- dmenu -i -p pass
-}
-
-get_passwords() {
- find -s "$prefix" -type f -name '*.gpg'
-}
-
-trim_prefix() {
- while read line
- do
- printf '%s\n' "${line##$prefix/}"
- done
-}
-
-trim_suffix() {
- while read line
- do
- printf '%s\n' "${line%%.gpg}"
- done
-}
-
-copy_pass() {
- [ -n "$1" ] || return
-
- otp=''
-
- case "$1" in
- totp*)
- otp=otp
- ;;
- esac
-
- pass $otp show --clip "$1" 2>/dev/null
-}
-
-password=$(get_passwords | trim_prefix | trim_suffix | get_password)
-[ -n "$password" ] || exit 0
-msg=$(copy_pass "$password")
-notify-send passmenu "$msg"
diff --git a/rofi-pass.sh b/rofi-pass.sh
new file mode 100755
index 0000000..1366466
--- /dev/null
+++ b/rofi-pass.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+prefix=${PASSWORD_STORE_DIR:-~/.password-store}
+
+get_passwords() {
+ find -s "$prefix" -type f -name '*.gpg'
+}
+
+trim_prefix() {
+ while read line
+ do
+ printf '%s\n' "${line##$prefix/}"
+ done
+}
+
+trim_gpg() {
+ while read line
+ do
+ printf '%s\n' "${line%%.gpg}"
+ done
+}
+
+[ -z "$2" ] && get_passwords | trim_prefix | trim_gpg && exit 0
+
+case "$1" in
+ otp*)
+ pass otp --clip "${2##totp:}" >/dev/null 2>&1 &
+ ;;
+ pass*)
+ pass show --clip "${2##password:}" >/dev/null 2>&1 &
+ ;;
+esac