Add script “passusermenu”
Add the script “passusermenu” to provide the same functionality as the “passmenu” script but copying the username using the “pass-user” plugin.
This commit is contained in:
parent
71bea304af
commit
6c1ca37fd3
1 changed files with 17 additions and 0 deletions
17
passusermenu
Executable file
17
passusermenu
Executable file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/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 user "$password" 2>/dev/null
|
||||||
|
|
||||||
|
# Send notification
|
||||||
|
notify-send -u critical -t 45000 "Username in clipboard" \
|
||||||
|
"The username for \"$password\" is currently in the clipboard."
|
||||||
Loading…
Add table
Add a link
Reference in a new issue