diff --git a/qutebrowser/app.py b/qutebrowser/app.py index dd6e2c99d..ef5cdc971 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -306,15 +306,9 @@ def _open_startpage(win_id=None): tabbed_browser = objreg.get('tabbed-browser', scope='window', window=cur_win_id) if tabbed_browser.count() == 0: - log.init.debug("Opening startpage") - for urlstr in config.val.start_page: - try: - url = urlutils.fuzzy_url(urlstr, do_search=False) - except urlutils.InvalidUrlError as e: - message.error("Error when opening startpage: {}".format(e)) - tabbed_browser.tabopen(QUrl('about:blank')) - else: - tabbed_browser.tabopen(url) + log.init.debug("Opening start pages") + for url in config.val.start_pages: + tabbed_browser.tabopen(url) def _open_special_pages(args): diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 3a429c17f..8eecc797a 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1192,7 +1192,7 @@ class CommandDispatcher: @cmdutils.register(instance='command-dispatcher', scope='window') def home(self): """Open main startpage in current tab.""" - self.openurl(config.val.start_page[0]) + self._current_widget().openurl(config.val.start_pages[0]) def _run_userscript(self, cmd, *args, verbose=False): """Run a userscript given as argument. diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 40597c3ff..37ce89879 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -106,10 +106,10 @@ session_default_name: desc: The name of the session to save by default, or unset for the last loaded session. -start_page: +start_pages: type: name: List - valtype: String + valtype: FuzzyUrl default: ["https://start.duckduckgo.com"] desc: The default page(s) to open at the start. diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index ea07b2b6a..d66a6e66e 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -263,8 +263,8 @@ class TabbedBrowser(tabwidget.TabWidget): elif last_close == 'blank': self.openurl(QUrl('about:blank'), newtab=True) elif last_close == 'startpage': - url = QUrl(config.val.start_page[0]) - self.openurl(url, newtab=True) + for url in config.val.start_pages: + self.openurl(url, newtab=True) elif last_close == 'default-page': url = config.val.default_page self.openurl(url, newtab=True) @@ -329,7 +329,7 @@ class TabbedBrowser(tabwidget.TabWidget): no_history = len(self.widget(0).history) == 1 urls = { 'blank': QUrl('about:blank'), - 'startpage': QUrl(config.val.start_page[0]), + 'startpage': config.val.start_pages[0], 'default-page': config.val.default_page, } first_tab_url = self.widget(0).url() diff --git a/tests/end2end/features/invoke.feature b/tests/end2end/features/invoke.feature index 8fecf4909..c63f4bc03 100644 --- a/tests/end2end/features/invoke.feature +++ b/tests/end2end/features/invoke.feature @@ -96,7 +96,7 @@ Feature: Invoking a new process Scenario: Opening a new qutebrowser instance with no parameters When I set new_instance_open_target to tab - And I set start_page to ["http://localhost:(port)/data/hello.txt"] + And I set start_pages to ["http://localhost:(port)/data/hello.txt"] And I open data/title.html And I spawn a new window And I wait until data/hello.txt is loaded diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 6eaa751b1..37af3af89 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -327,12 +327,12 @@ Feature: Various utility commands. # :home Scenario: :home with single page - When I set start_page to ["http://localhost:(port)/data/hello2.txt"] + When I set start_pages to ["http://localhost:(port)/data/hello2.txt"] And I run :home Then data/hello2.txt should be loaded Scenario: :home with multiple pages - When I set start_page to ["http://localhost:(port)/data/numbers/1.txt", "http://localhost:(port)/data/numbers/2.txt"] + When I set start_pages to ["http://localhost:(port)/data/numbers/1.txt", "http://localhost:(port)/data/numbers/2.txt"] And I run :home Then data/numbers/1.txt should be loaded diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index cc05ca9ef..827840c4d 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -715,7 +715,7 @@ Feature: Tab management When I open data/hello.txt And I run :tab-only And I set tabs.last_close to startpage - And I set start_page to ["http://localhost:(port)/data/numbers/4.txt", "http://localhost:(port)/data/numbers/5.txt"] + And I set start_pages to ["http://localhost:(port)/data/numbers/4.txt"] And I run :tab-close And I wait until data/numbers/4.txt is loaded And I run :undo @@ -807,14 +807,16 @@ Feature: Tab management - about:blank (active) Scenario: last-close = startpage - When I set start_page to ["http://localhost:(port)/data/numbers/7.txt", "http://localhost:(port)/data/numbers/8.txt"] + When I set start_pages to ["http://localhost:(port)/data/numbers/7.txt", "http://localhost:(port)/data/numbers/8.txt"] And I set tabs.last_close to startpage And I open data/hello.txt And I run :tab-only And I run :tab-close And I wait until data/numbers/7.txt is loaded + And I wait until data/numbers/8.txt is loaded Then the following tabs should be open: - - data/numbers/7.txt (active) + - data/numbers/7.txt + - data/numbers/8.txt (active) Scenario: last-close = default-page When I set default_page to http://localhost:(port)/data/numbers/9.txt diff --git a/tests/end2end/features/test_invoke_bdd.py b/tests/end2end/features/test_invoke_bdd.py index 5d463608e..f8de1002c 100644 --- a/tests/end2end/features/test_invoke_bdd.py +++ b/tests/end2end/features/test_invoke_bdd.py @@ -27,4 +27,4 @@ def invoke_with(quteproc): quteproc.log_summary("Create a new window") quteproc.send_ipc([], target_arg='window') quteproc.wait_for(category='init', module='app', - function='_open_startpage', message='Opening startpage') + function='_open_startpage', message='Opening start pages')