diff options
| author | 2026-02-11 02:47:33 +0000 | |
|---|---|---|
| committer | 2026-02-11 02:47:33 +0000 | |
| commit | 2c485ce2b43bd810a88278215b771136a2a17881 (patch) | |
| tree | 3fb74338b87553d898af7b1795de7322cbc5af63 /private_dot_local/bin/executable_passmenu | |
| parent | add xdg (diff) | |
| download | dotfiles-2c485ce2b43bd810a88278215b771136a2a17881.tar.gz | |
add scripts
Diffstat (limited to 'private_dot_local/bin/executable_passmenu')
| -rw-r--r-- | private_dot_local/bin/executable_passmenu | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/private_dot_local/bin/executable_passmenu b/private_dot_local/bin/executable_passmenu new file mode 100644 index 0000000..1aa1158 --- /dev/null +++ b/private_dot_local/bin/executable_passmenu | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | typeit=0 | ||
| 4 | nameit=0 | ||
| 5 | while true; do | ||
| 6 | case $1 in | ||
| 7 | "--type") | ||
| 8 | typeit=1 | ||
| 9 | shift | ||
| 10 | ;; | ||
| 11 | "--name") | ||
| 12 | nameit=1 | ||
| 13 | shift | ||
| 14 | ;; | ||
| 15 | *) | ||
| 16 | break | ||
| 17 | ;; | ||
| 18 | esac | ||
| 19 | done | ||
| 20 | |||
| 21 | prefix=${PASSWORD_STORE_DIR-~/.password-store} | ||
| 22 | password=$(find $prefix -name '*.gpg' | sed "s@$prefix/\(.*\)\.gpg@\1@" | $MENU "$@") | ||
| 23 | |||
| 24 | [ -n "$password" ] || exit | ||
| 25 | |||
| 26 | if [ $nameit = 0 ]; then | ||
| 27 | what=$(pass show "$password" | head -n 1) | ||
| 28 | [ -n "$what" ] || exit | ||
| 29 | else | ||
| 30 | what=$(basename $password) | ||
| 31 | fi | ||
| 32 | |||
| 33 | if [ $typeit = 0 ]; then | ||
| 34 | printf "$what" | wl-copy | ||
| 35 | if [ $nameit = 0 ]; then | ||
| 36 | notify-send "Coppied password for:" "$password" | ||
| 37 | else | ||
| 38 | notify-send "Coppied password name:" "$password" | ||
| 39 | fi | ||
| 40 | else | ||
| 41 | printf "$what" | wtype - -k Tab | ||
| 42 | fi | ||
