From 8712fc6fd36c71221bf3d09472d7612f612a7c9a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 3 Jul 2017 15:27:58 +0200 Subject: [PATCH] Move new_instance_open_target out of url. It doesn't really fit there really... See 3cf028db23cbfe256e499d8881c3c2856f224d94 --- qutebrowser/app.py | 2 +- qutebrowser/config/configdata.yml | 52 +++++++++++++-------------- qutebrowser/mainwindow/mainwindow.py | 4 +-- tests/end2end/features/invoke.feature | 20 +++++------ tests/end2end/fixtures/quteprocess.py | 2 +- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 3b416ed0b..2a8b46bc4 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -270,7 +270,7 @@ def process_pos_args(args, via_ipc=False, cwd=None, target_arg=None): if via_ipc and target_arg and target_arg != 'auto': open_target = target_arg else: - open_target = config.val.url.new_instance_open_target + open_target = config.val.new_instance_open_target win_id = mainwindow.get_window(via_ipc, force_target=open_target) tabbed_browser = objreg.get('tabbed-browser', scope='window', window=win_id) diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 545a09340..6a6da6cf3 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -36,6 +36,32 @@ ignore_case: default: smart desc: Whether to find text on a page case-insensitively. +new_instance_open_target: + type: + name: String + valid_values: + - tab: Open a new tab in the existing window and activate the window. + - tab-bg: Open a new background tab in the existing window and activate + the window. + - tab-silent: Open a new tab in the existing window without activating the + window. + - tab-bg-silent: Open a new background tab in the existing window without + activating the window. + - window: Open in a new window. + default: tab + desc: How to open links in an existing instance if a new one is launched. + +new_instance_open_target_window: + type: + name: String + valid_values: + - first-opened: Open new tabs in the first (oldest) opened window. + - last-opened: Open new tabs in the last (newest) opened window. + - last-focused: Open new tabs in the most recently focused window. + - last-visible: Open new tabs in the most recently visible window. + default: last-focused + desc: Which window to choose when opening links as new tabs. + session_default_name: type: name: SessionName @@ -1110,32 +1136,6 @@ url.incdec_segments: desc: The URL segments where `:navigate increment/decrement` will search for a number. -url.new_instance_open_target: - type: - name: String - valid_values: - - tab: Open a new tab in the existing window and activate the window. - - tab-bg: Open a new background tab in the existing window and activate - the window. - - tab-silent: Open a new tab in the existing window without activating the - window. - - tab-bg-silent: Open a new background tab in the existing window without - activating the window. - - window: Open in a new window. - default: tab - desc: How to open links in an existing instance if a new one is launched. - -url.new_instance_open_target_window: - type: - name: String - valid_values: - - first-opened: Open new tabs in the first (oldest) opened window. - - last-opened: Open new tabs in the last (newest) opened window. - - last-focused: Open new tabs in the most recently focused window. - - last-visible: Open new tabs in the most recently visible window. - default: last-focused - desc: Which window to choose when opening links as new tabs. - url.searchengines: default: DEFAULT: https://duckduckgo.com/?q={} diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 7005aa453..8b39322f5 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -60,7 +60,7 @@ def get_window(via_ipc, force_window=False, force_tab=False, # Initial main window return 0 - open_target = config.val.url.new_instance_open_target + open_target = config.val.new_instance_open_target # Apply any target overrides, ordered by precedence if force_target is not None: @@ -98,7 +98,7 @@ def get_window(via_ipc, force_window=False, force_tab=False, def get_target_window(): """Get the target window for new tabs, or None if none exist.""" try: - win_mode = config.val.url.new_instance_open_target_window + win_mode = config.val.new_instance_open_target_window if win_mode == 'last-focused': return objreg.last_focused_window() elif win_mode == 'first-opened': diff --git a/tests/end2end/features/invoke.feature b/tests/end2end/features/invoke.feature index a52bc424f..e8b6035a8 100644 --- a/tests/end2end/features/invoke.feature +++ b/tests/end2end/features/invoke.feature @@ -7,7 +7,7 @@ Feature: Invoking a new process Given I clean up open tabs Scenario: Using new-instance-open-target = tab - When I set url.new_instance_open_target to tab + When I set new_instance_open_target to tab And I open data/title.html And I open data/search.html as a URL Then the following tabs should be open: @@ -15,7 +15,7 @@ Feature: Invoking a new process - data/search.html (active) Scenario: Using new-instance-open-target = tab-bg - When I set url.new_instance_open_target to tab-bg + When I set new_instance_open_target to tab-bg And I open data/title.html And I open data/search.html as a URL Then the following tabs should be open: @@ -23,7 +23,7 @@ Feature: Invoking a new process - data/search.html Scenario: Using new-instance-open-target = window - When I set url.new_instance_open_target to window + When I set new_instance_open_target to window And I open data/title.html And I open data/search.html as a URL Then the session should look like: @@ -37,8 +37,8 @@ Feature: Invoking a new process - url: http://localhost:*/data/search.html Scenario: Using new-instance-open-target_window = last-opened - When I set url.new_instance_open_target to tab - And I set url.new_instance_open_target_window to last-opened + When I set new_instance_open_target to tab + And I set new_instance_open_target_window to last-opened And I open data/title.html And I open data/search.html in a new window And I open data/hello.txt as a URL @@ -55,8 +55,8 @@ Feature: Invoking a new process - url: http://localhost:*/data/hello.txt Scenario: Using new-instance-open-target_window = first-opened - When I set url.new_instance_open_target to tab - And I set url.new_instance_open_target_window to first-opened + When I set new_instance_open_target to tab + And I set new_instance_open_target_window to first-opened And I open data/title.html And I open data/search.html in a new window And I open data/hello.txt as a URL @@ -75,8 +75,8 @@ Feature: Invoking a new process # issue #1060 Scenario: Using target_window = first-opened after tab-detach - When I set url.new_instance_open_target to tab - And I set url.new_instance_open_target_window to first-opened + When I set new_instance_open_target to tab + And I set new_instance_open_target_window to first-opened And I open data/title.html And I open data/search.html in a new tab And I run :tab-detach @@ -95,7 +95,7 @@ Feature: Invoking a new process - url: http://localhost:*/data/search.html Scenario: Opening a new qutebrowser instance with no parameters - When I set url.new_instance_open_target to tab + When I set new_instance_open_target to tab And I set url.start_pages to ["http://localhost:(port)/data/hello.txt"] And I open data/title.html And I spawn a new window diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index 58ac2fef5..2b0acb2f3 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -453,7 +453,7 @@ class QuteProc(testprocess.Process): settings = [ ('messages.timeout', '0'), ('auto_save.interval', '0'), - ('url.new_instance_open_target_window', 'last-opened') + ('new_instance_open_target_window', 'last-opened') ] if not self.request.config.webengine: settings.append(('content.ssl_strict', 'false'))