diff options
| author | Robert Günzler <r@gnzler.io> | 2022-11-18 18:08:05 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2022-11-18 18:38:21 +0100 |
| commit | 15e75bb089540747fd66ae2229f5c828f28d8945 (patch) | |
| tree | 5a7edd384d3f9b5d33d1db782060c5da45e04b7f /bin/passmenu | |
| parent | f005fbf41646437964458d4c2028e6fdc04b59a1 (diff) | |
bin/passmenu: rename to secretmenu and make it work with bitwarden
Diffstat (limited to 'bin/passmenu')
| l---------[-rwxr-xr-x] | bin/passmenu | 60 |
1 files changed, 1 insertions, 59 deletions
diff --git a/bin/passmenu b/bin/passmenu index e81a29a..e7f48fd 100755..120000 --- a/bin/passmenu +++ b/bin/passmenu @@ -1,59 +1 @@ -#!/bin/bash - -set -eo pipefail -[ -n "$DEBUG" ] && set -x - -trap '{ notify-send -a passmenu -i "$(iconez -n form-textbox-passworrd)" -c error "passmenu: failed :(" "<i>pipefail</i>"; exit 1; }' ERR - -# check requirements -for tool in bemenu fd fzf; do - if ! command -v "$tool" >/dev/null; then - printf "%s: %s not installed but required\n" "$(basename "$0")" "$tool" >&2 - exit 1 - fi -done - -typeit= -if [ "$1" = "--type" ]; then - typeit=1 - shift -fi - -if [ "$1" = "-t" ]; then - _dmenu() { - fzf - } -else - _dmenu() { - MENU_PROMPT=" pass" menu - } -fi - -prefix=${PASSWORD_STORE_DIR-~/.password-store} -prefix=$(readlink -f -- "${prefix}") -password_files=$( - fd -e gpg . "${prefix}" | sed -e "s#${prefix}/##" -e 's#\.gpg$##' -) - -password=$(printf '%s\n' "${password_files[@]}" | _dmenu "$@") -[ -n "$password" ] || exit 1 - -err=$(pass show "$password" 2>&1 | - awk 'NR==1 {system("wl-copy -o -n " $0);hit+=1} /^Username:/ {system("wl-copy -n -p " $2);hit+=1} END{if(hit==0) print("no password found")}') - -# shellcheck disable=SC2181 -if [ "$?" -ne 0 ] || [ -n "$err" ]; then - notify-send \ - -a passmenu \ - -i /usr/share/icons/mdi/scalable/form-textbox-password.svg \ - -c error \ - 'passmenu: failed :(' \ - "<i>${err}</i>" - exit 1 -fi - -notify-send \ - -a passmenu \ - -i /usr/share/icons/mdi/scalable/form-textbox-password.svg \ - 'passmenu: password copied' \ - '<i>will be removed after next paste</i>' +secretmenu \ No newline at end of file |