summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Keller <andre.keller@vshn.ch>2021-08-03 14:54:21 +0200
committerAndré Keller <andre.keller@vshn.ch>2021-08-03 14:54:21 +0200
commit6ba917d5ecf9f7ccd8a335f4a5ccfe45f3f13083 (patch)
tree73b7c78b11aca604943f8779d3b7cc56b4052c00
parent08fdc1fdc5eff7a481ccbc32e7730eb2b912afd1 (diff)
downloadqutebrowser-6ba917d5ecf9f7ccd8a335f4a5ccfe45f3f13083.tar.gz
qutebrowser-6ba917d5ecf9f7ccd8a335f4a5ccfe45f3f13083.zip
Optionally ask for confirmation before inserting a password
The default behaviour of qute-pass userscript will insert a password automatically if there is only a single candidate found. This option will force the selection prompt (i.e. dmenu) to show regardless of how many password candidates are found.
-rwxr-xr-xmisc/userscripts/qute-pass8
1 files changed, 7 insertions, 1 deletions
diff --git a/misc/userscripts/qute-pass b/misc/userscripts/qute-pass
index 71646eb69..d7b0af819 100755
--- a/misc/userscripts/qute-pass
+++ b/misc/userscripts/qute-pass
@@ -92,6 +92,8 @@ argument_parser.add_argument('--merge-candidates', '-m', action='store_true',
help='Merge pass candidates for fully-qualified and registered domain name')
argument_parser.add_argument('--extra-url-suffixes', '-s', default='',
help='Comma-separated string containing extra suffixes (e.g local)')
+argument_parser.add_argument('--always-show-selection', dest='always_show_selection', action='store_true',
+ help='Always show selection, even if there is only a single match')
group = argument_parser.add_mutually_exclusive_group()
group.add_argument('--username-only', '-e', action='store_true', help='Only insert username')
group.add_argument('--password-only', '-w', action='store_true', help='Only insert password')
@@ -235,7 +237,11 @@ def main(arguments):
stderr('No pass candidates for URL {!r} found! (I tried {!r})'.format(arguments.url, attempted_targets))
return ExitCodes.NO_PASS_CANDIDATES
- selection = candidates.pop() if len(candidates) == 1 else dmenu(sorted(candidates), arguments.dmenu_invocation)
+ if len(candidates) == 1 and not arguments.always_show_selection:
+ selection = candidates.pop()
+ else:
+ selection = dmenu(sorted(candidates), arguments.dmenu_invocation)
+
# Nothing was selected, simply return
if not selection:
return ExitCodes.SUCCESS