scripts/passmenu
coderkun fe93010b04 Add script “passmenu”
Add the script “passmenu” to provide the same functionality as the
official “passmenu” script but using “bemenu” instead of “dmenu”.
2020-07-04 13:37:20 +02:00

18 lines
540 B
Bash
Executable file

#!/bin/sh
set -e
shopt -s nullglob globstar
# Present menu to select password
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
password=$(printf '%s\n' "${password_files[@]}" | bemenu $@)
# Copy password to clipboard
pass show -c "$password" 2>/dev/null
# Send notification
notify-send -u critical -t 45000 "Password in clipboard" \
"The password for \"$password\" is currently in the clipboard."