diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 89053ac25..db58b4d20 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -196,7 +196,6 @@ class QuteBrowser(QApplication): # we make sure the GUI is refreshed here, so the start seems faster. self.processEvents(QEventLoop.ExcludeUserInputEvents | QEventLoop.ExcludeSocketNotifiers) - opened_urls = False for e in self._args.command: if e.startswith(':'): @@ -204,10 +203,9 @@ class QuteBrowser(QApplication): self.commandparser.run(e.lstrip(':')) else: logging.debug('Startup url {}'.format(e)) - opened_urls = True self.mainwindow.tabs.tabopen(e) - if not opened_urls: + if self.mainwindow.tabs.count() == 0: logging.debug('Opening startpage') for url in config.config.get('general', 'startpage').split(','): self.mainwindow.tabs.tabopen(url) diff --git a/qutebrowser/widgets/browser.py b/qutebrowser/widgets/browser.py index 224e1062a..faa85c110 100644 --- a/qutebrowser/widgets/browser.py +++ b/qutebrowser/widgets/browser.py @@ -365,7 +365,15 @@ class TabbedBrowser(TabWidget): """ tab = self._widget(count) - if tab is not None: + if tab is None: + if count is None: + # We want to open an URL in the current tab, but none exists + # yet. + self.tabopen(url) + else: + # Explicit count with a tab that doesn't exist. + return + else: tab.openurl(url) def cur_reload(self, count=None):