summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2018-05-03 09:13:31 +0200
committerFlorian Bruhin <git@the-compiler.org>2018-05-03 09:13:31 +0200
commitb80fa7a197b2d2376fb194aa384c8603111d074e (patch)
tree9a530c25c07bd9957fd26138fc970dadba5adf36
parent3cc790afb329757f061833f80e221ad2e503bae3 (diff)
parent801e9e0334dcc58cbe52b936951d93c1e3c1e3c7 (diff)
downloadqutebrowser-b80fa7a197b2d2376fb194aa384c8603111d074e.tar.gz
qutebrowser-b80fa7a197b2d2376fb194aa384c8603111d074e.zip
Merge remote-tracking branch 'origin/pr/3858'
-rwxr-xr-xmisc/userscripts/qute-pass19
1 files changed, 15 insertions, 4 deletions
diff --git a/misc/userscripts/qute-pass b/misc/userscripts/qute-pass
index 5bab9db93..892f9c5da 100755
--- a/misc/userscripts/qute-pass
+++ b/misc/userscripts/qute-pass
@@ -109,6 +109,13 @@ def dmenu(items, invocation, encoding):
return process.stdout.decode(encoding).strip()
+def fake_key_raw(text):
+ for character in text:
+ # Escape all characters by default, space requires special handling
+ sequence = '" "' if character == ' ' else '\{}'.format(character)
+ qute_command('fake-key {}'.format(sequence))
+
+
def main(arguments):
if not arguments.url:
argument_parser.print_help()
@@ -158,15 +165,19 @@ 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 {}{}'.format(username, insert_mode))
+ fake_key_raw(username)
elif arguments.password_only:
- qute_command('fake-key {}{}'.format(password, insert_mode))
+ fake_key_raw(password)
else:
# Enter username and password using fake-key and <Tab> (which seems to work almost universally), then switch
# back into insert-mode, so the form can be directly submitted by hitting enter afterwards
- qute_command('fake-key {} ;; fake-key <Tab> ;; fake-key {}{}'.format(username, password, insert_mode))
+ fake_key_raw(username)
+ qute_command('fake-key <Tab>')
+ fake_key_raw(password)
+
+ if arguments.insert_mode:
+ qute_command('enter-mode insert')
return ExitCodes.SUCCESS