From 4891fe94577191e4eea047e48a997324ce8b6aed Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 27 Aug 2015 20:28:16 +0200 Subject: [PATCH] Always expand ~ when starting scripts. --- qutebrowser/browser/commands.py | 3 ++- qutebrowser/commands/userscripts.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 1e3a1cf16..2ac5149f9 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -967,8 +967,10 @@ class CommandDispatcher: log.procs.debug("Executing {} with args {}, userscript={}".format( cmd, args, userscript)) if userscript: + # ~ expansion is handled by the userscript module. self.run_userscript(cmd, *args, verbose=verbose) else: + cmd = os.path.expanduser(cmd) proc = guiprocess.GUIProcess(self._win_id, what='command', verbose=verbose, parent=self._tabbed_browser) @@ -992,7 +994,6 @@ class CommandDispatcher: args: Arguments to pass to the userscript. verbose: Show notifications when the command started/exited. """ - cmd = os.path.expanduser(cmd) env = { 'QUTE_MODE': 'command', } diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index 658dfff98..9f2b0fe10 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -343,6 +343,7 @@ def run(cmd, *args, win_id, env, verbose=False): user_agent = config.get('network', 'user-agent') if user_agent is not None: env['QUTE_USER_AGENT'] = user_agent + cmd = os.path.expanduser(cmd) runner.run(cmd, *args, env=env, verbose=verbose) runner.finished.connect(commandrunner.deleteLater) runner.finished.connect(runner.deleteLater)