[gopass] Add password revealing to rofi-gopass

When an individual entry is opened the hidden password can now be
revealed, using `Alt+s` by default.
This commit is contained in:
Marty Oehme 2020-06-17 11:40:30 +02:00
parent 589211ed3a
commit 7456bb14ab
No known key found for this signature in database
GPG key ID: 0CCB0526EFB9611A
3 changed files with 29 additions and 15 deletions

View file

@ -61,6 +61,7 @@ set_defaults() {
KEY_CLIP_PASS="${RGP_KEY_CLIP_PASS:-$(get_config KEY_CLIP_PASS Ctrl+Alt+p)}"
KEY_ENTRYMENU_FILL="${RGP_KEY_ENTRYMENU_FILL:-$(get_config KEY_ENTRYMENU_FILL Return)}"
KEY_ENTRYMENU_CLIP="${RGP_KEY_ENTRYMENU_CLIP:-$(get_config KEY_ENTRYMENU_CLIP Alt+Return)}"
KEY_ENTRYMENU_SHOWFIELD="${KEY_ENTRYMENU_SHOWFIELD:-$(get_config KEY_ENTRYMENU_SHOWFIELD Alt+s)}"
KEY_ENTRYMENU_QUIT="${RGP_KEY_ENTRYMENU_QUIT:-$(get_config KEY_ENTRYMENU_QUIT Alt+BackSpace)}"
AUTOFILL_BACKEND="${RGP_BACKEND:-$(get_config AUTOFILL_BACKEND xdotool)}"
@ -162,21 +163,29 @@ autofill() {
# opens a menu for the specified gopass entry, containing its individual fields
entrymenu() {
local entry="$1"
local deobfuscate="$2"
local k_entrymenu_fill="${KEY_ENTRYMENU_FILL}"
local k_entrymenu_clip="${KEY_ENTRYMENU_CLIP}"
local k_entrymenu_showfield="${KEY_ENTRYMENU_SHOWFIELD}"
local k_entrymenu_quit="${KEY_ENTRYMENU_QUIT}"
local pass_obfuscation="(hidden)"
local pass
if [ "$deobfuscate" = "true" ]; then
pass="$(show_password "$entry")"
else
pass="(hidden)"
fi
local field
field=$(
printf "password: %s\n%s" "$pass_obfuscation" "$(list_fields "$entry")" |
printf "password: %s\n%s" "$pass" "$(list_fields "$entry")" |
_rofi \
-kb-accept-entry "" \
-kb-custom-1 "$k_entrymenu_fill" \
-kb-custom-2 "$k_entrymenu_clip" \
-kb-custom-3 "$k_entrymenu_quit" \
-mesg " ᐊ $k_entrymenu_quit ᐊ | $k_entrymenu_fill: fill selection | $k_entrymenu_clip: clip selection |"
-kb-custom-4 "$k_entrymenu_showfield" \
-mesg " ᐊ $k_entrymenu_quit ᐊ | $k_entrymenu_fill: fill selection | $k_entrymenu_clip: clip selection | $k_entrymenu_showfield: reveal password"
)
exit_value=$?
exit_check "$exit_value"
@ -203,6 +212,9 @@ entrymenu() {
"12")
main
;;
"13")
entrymenu "$entry" "true"
;;
esac
}