From 6c1ca37fd3b073bcbde6ec26ce96a5fa3a0d61ac Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 12 Sep 2021 21:15:02 +0200 Subject: [PATCH] =?UTF-8?q?Add=20script=20=E2=80=9Cpassusermenu=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the script “passusermenu” to provide the same functionality as the “passmenu” script but copying the username using the “pass-user” plugin. --- passusermenu | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 passusermenu diff --git a/passusermenu b/passusermenu new file mode 100755 index 0000000..36f71f2 --- /dev/null +++ b/passusermenu @@ -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."