Hi all,
for a few month I use pass now which I find a very handy solution
especially for a multi user approach with git.
One feature I'm missing: it's only possible storing the password in the
clipboard. I've a lot of different usernames on different sites. So if I
want to know the username of a login I have to show the password entry
in clear text.
Since the xclip has the ability to store more then one entry, I thought
it could be nice to store the username e.g. in the primary selection of
xclip (in many X-environments accessible with the middle mouse button)
while the password is stored in the clipboard (like on figaros password
manager).
The attached patch should work against version 1.6.5
Now there is an second "X_SELECTION" for username available, which is
also configurable:
PASSWORD_STORE_X_SELECTION_2="primary" # (default)
Now I add my pass entries whith password in first and username in second
line.
Best Regards
Jan
diff --git a/src/password-store.sh b/src/password-store.sh
index 47f7ffa..3b1dba0 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -14,6 +14,7 @@ which gpg2 &>/dev/null && GPG="gpg2"
PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
X_SELECTION="${PASSWORD_STORE_X_SELECTION:-clipboard}"
+X_SELECTION_2="${PASSWORD_STORE_X_SELECTION_2:-primary}"
CLIP_TIME="${PASSWORD_STORE_CLIP_TIME:-45}"
export GIT_DIR="${PASSWORD_STORE_GIT:-$PREFIX}/.git"
@@ -128,10 +129,11 @@ check_sneaky_paths() {
#
clip() {
+ X_SELECTION="$3"
# This base64 business is because bash cannot store binary data in a shell
# variable. Specifically, it cannot store nulls nor (non-trivally) store
# trailing new lines.
- local sleep_argv0="password store sleep on display $DISPLAY"
+ local sleep_argv0="password store $X_SELECTION sleep on display $DISPLAY"
pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
local before="$(xclip -o -selection "$X_SELECTION" 2>/dev/null | base64)"
echo -n "$1" | xclip -selection "$X_SELECTION" || die "Error: Could not copy data to the clipboard"
@@ -314,7 +316,11 @@ cmd_show() {
else
local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | head -n 1)"
[[ -n $pass ]] || exit 1
- clip "$pass" "$path"
+ clip "$pass" "$path" $X_SELECTION
+ # store the second line e.g. username
+ local user="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | head -n 2 | tail -n 1)"
+ #clip2 "$user" "second line (username)" $X_SELECTION_2
+ clip "$user" "second line (username)" $X_SELECTION_2
fi
elif [[ -d $PREFIX/$path ]]; then
if [[ -z $path ]]; then
_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store