From 6ba917d5ecf9f7ccd8a335f4a5ccfe45f3f13083 Mon Sep 17 00:00:00 2001 From: André Keller Date: Tue, 3 Aug 2021 14:54:21 +0200 Subject: 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. --- misc/userscripts/qute-pass | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-54-g00ecf