From 45ac2e4835c816dfaf7c644a745600d6ecd83734 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 29 Sep 2014 19:56:37 +0200 Subject: [PATCH] Fix getting URL for startup commands. --- qutebrowser/commands/runners.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index ccb859163..0fbbba19d 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -32,10 +32,12 @@ def replace_variables(win_id, arglist): args = [] tabbed_browser = objreg.get('tabbed-browser', scope='window', window=win_id) - url = tabbed_browser.current_url().toString(QUrl.FullyEncoded | - QUrl.RemovePassword) for arg in arglist: if arg == '{url}': + # Note we have to do this in here as the user gets an error message + # by current_url if no URL is open yet. + url = tabbed_browser.current_url().toString(QUrl.FullyEncoded | + QUrl.RemovePassword) args.append(url) else: args.append(arg)