diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 3dcfc37c3..b3348f18a 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -219,12 +219,17 @@ class Application(QApplication): # we make sure the GUI is refreshed here, so the start seems faster. self.processEvents(QEventLoop.ExcludeUserInputEvents | QEventLoop.ExcludeSocketNotifiers) - tabbed_browser = objreg.get('tabbed-browser', scope='window', window=0) + win_id = 0 for cmd in self._args.command: if cmd.startswith(':'): log.init.debug("Startup cmd {}".format(cmd)) self._commandrunner.run_safely_init(0, cmd.lstrip(':')) + elif not cmd: + log.init.debug("Empty argument") + win_id = mainwindow.create_window(True) else: + tabbed_browser = objreg.get('tabbed-browser', scope='window', + window=win_id) log.init.debug("Startup URL {}".format(cmd)) try: url = urlutils.fuzzy_url(cmd) @@ -234,16 +239,19 @@ class Application(QApplication): else: tabbed_browser.tabopen(url) - if tabbed_browser.count() == 0: - log.init.debug("Opening startpage") - for urlstr in config.get('general', 'startpage'): - try: - url = urlutils.fuzzy_url(urlstr) - except urlutils.FuzzyUrlError as e: - message.error(0, "Error when opening startpage: " - "{}".format(e)) - else: - tabbed_browser.tabopen(url) + for win_id in objreg.window_registry: + tabbed_browser = objreg.get('tabbed-browser', scope='window', + window=win_id) + if tabbed_browser.count() == 0: + log.init.debug("Opening startpage") + for urlstr in config.get('general', 'startpage'): + try: + url = urlutils.fuzzy_url(urlstr) + except urlutils.FuzzyUrlError as e: + message.error(0, "Error when opening startpage: " + "{}".format(e)) + else: + tabbed_browser.tabopen(url) def _python_hacks(self): """Get around some PyQt-oddities by evil hacks. diff --git a/qutebrowser/qutebrowser.py b/qutebrowser/qutebrowser.py index e2f1578a8..832bf0272 100644 --- a/qutebrowser/qutebrowser.py +++ b/qutebrowser/qutebrowser.py @@ -91,7 +91,8 @@ def get_argparser(): parser.add_argument('command', nargs='*', help="Commands to execute on " "startup.", metavar=':command') # URLs will actually be in command - parser.add_argument('url', nargs='*', help="URLs to open on startup.") + parser.add_argument('url', nargs='*', help="URLs to open on startup " + "(empty as a window separator).") return parser