diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-01 13:32:36 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-01 13:34:53 +0200 |
commit | 82d07da3add2393c53d20e41e8aba383f058858f (patch) | |
tree | 20e62d7b1cc5428703f1cde9500efa54c52daf50 /bin/menuscripts/mpass | |
parent | cf01ac4c10ecd0cdffed722fd58301ebfddd0d61 (diff) |
checkpoint
Diffstat (limited to 'bin/menuscripts/mpass')
-rwxr-xr-x | bin/menuscripts/mpass | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass new file mode 100755 index 0000000..7029ffe --- /dev/null +++ b/bin/menuscripts/mpass @@ -0,0 +1,27 @@ +#!/usr/bin/env sh +store="${PASSWORD_STORE_DIR:-$HOME/.password-store}" + +# list passwords, group directories first +list_pswds() +{ + find "$1" \ + -maxdepth 1 -mindepth 1 \ + -not -name '.*' -type d -printf "%y\t%f\n" -o \ + -not -name '.*' -not -type d -printf "%y\t%f\n" | + sort -k1 -k2 | + cut -f 2 | sed 's/\.gpg$//' +} + +while [ -d "$store/$file" ] +do + choice="$(list_pswds "$store/$file" | commander -c)" + [ "$choice" ] || exit 1 + [ -z "$file" ] && file="$choice" || file="$file/$choice" +done +[ "$file" ] || exit 1 + +pass show -c "$file" || exit 1 +notify-send -t 1000 "mpass" "copied <b>$file</b>" + +[ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running + cliphist list | head -n 1 | cliphist delete |