From 6d37e4671a2dc256c8dd1da900aa55ba4b4c1d99 Mon Sep 17 00:00:00 2001 From: cryzed Date: Wed, 1 Nov 2017 19:08:49 +0100 Subject: [PATCH] Add support for not automatically entering insert mode --- misc/userscripts/qute-passmenu | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/misc/userscripts/qute-passmenu b/misc/userscripts/qute-passmenu index 9c77f61a8..6f3b22e8b 100755 --- a/misc/userscripts/qute-passmenu +++ b/misc/userscripts/qute-passmenu @@ -41,6 +41,8 @@ argument_parser.add_argument('--password-pattern', '-P', default=r'(.*)', help='Regular expression that matches the password') argument_parser.add_argument('--dmenu-invocation', '-d', default='rofi -dmenu', help='Invocation used to execute a dmenu-provider') +argument_parser.add_argument('--no-insert-mode', '-n', dest='insert_mode', action='store_false', + help="Don't automatically enter insert mode") group = argument_parser.add_mutually_exclusive_group() group.add_argument('--username-only', '-uo', action='store_true', help='Only insert username') group.add_argument('--password-only', '-po', action='store_true', help='Only insert password') @@ -122,14 +124,15 @@ def main(arguments): return ExitCodes.COULD_NOT_MATCH_PASSWORD password = match.group(1) + insert_mode = ';; enter-mode insert' if arguments.insert_mode else '' if arguments.username_only: - qute_command('fake-key {} ;; enter-mode insert'.format(username)) + qute_command('fake-key {}{}'.format(username, insert_mode)) elif arguments.password_only: - qute_command('fake-key {} ;; enter-mode insert'.format(password)) + qute_command('fake-key {}{}'.format(password, insert_mode)) else: # Enter username and password using fake-key and (which seems to work almost universally) and switch back # into insert-mode, so the form can be directly submitted by hitting enter afterwards - qute_command('fake-key {} ;; fake-key ;; fake-key {} ;; enter-mode insert'.format(username, password)) + qute_command('fake-key {} ;; fake-key ;; fake-key {}{}'.format(username, password, insert_mode)) return ExitCodes.SUCCESS