diff options
author | Anton S <residentsummer@gmail.com> | 2017-10-10 23:02:10 +0300 |
---|---|---|
committer | Anton S <residentsummer@gmail.com> | 2017-10-10 23:02:10 +0300 |
commit | ba1a7a8de8ca8c3f6838ff5a82eb686571bf8706 (patch) | |
tree | f229b43f11a88c2cf8074d5503669e8201b6796f | |
parent | e1f5da3eff50c44462562f900314125f9494a173 (diff) | |
download | qutebrowser-ba1a7a8de8ca8c3f6838ff5a82eb686571bf8706.tar.gz qutebrowser-ba1a7a8de8ca8c3f6838ff5a82eb686571bf8706.zip |
[review] force_raise -> no_raise
-rw-r--r-- | qutebrowser/app.py | 12 | ||||
-rw-r--r-- | qutebrowser/mainwindow/mainwindow.py | 9 |
2 files changed, 7 insertions, 14 deletions
diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 937324afd..2520d5b7b 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -300,24 +300,20 @@ def process_pos_args(args, via_ipc=False, cwd=None, target_arg=None): win_id = open_url(url, target=open_target) -def open_url(url, target=None, force_raise=None): +def open_url(url, target=None, no_raise=False): """Open an URL in new window/tab Args: url: An URL to open target: same as new_instance_open_target (used as a default) - force_raise: control target window raising: - * None - obey new_instance_open_target - * True - always raise - * False - never raise + no_raise: suppress target window raising Return: ID of a window that was used to open URL """ target = target or config.val.new_instance_open_target background = target in {'tab-bg', 'tab-bg-silent'} - win_id = mainwindow.get_window(True, force_target=target, - force_raise=force_raise) + win_id = mainwindow.get_window(True, force_target=target, no_raise=no_raise) tabbed_browser = objreg.get('tabbed-browser', scope='window', window=win_id) log.init.debug("About to open URL: {}".format(url.toDisplayString())) @@ -844,7 +840,7 @@ class Application(QApplication): def event(self, e): if e.type() == QEvent.FileOpen: - open_url(e.url(), force_raise=False) + open_url(e.url(), no_raise=True) else: return super().event(e) diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 2eccf67c7..669a03327 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -43,7 +43,7 @@ win_id_gen = itertools.count(0) def get_window(via_ipc, force_window=False, force_tab=False, - force_target=None, force_raise=None): + force_target=None, no_raise=False): """Helper function for app.py to get a window id. Args: @@ -51,10 +51,7 @@ def get_window(via_ipc, force_window=False, force_tab=False, force_window: Whether to force opening in a window. force_tab: Whether to force opening in a tab. force_target: Override the new_instance_open_target config - force_raise: control target window raising: - * None - obey new_instance_open_target - * True - always raise - * False - never raise + no_raise: suppress target window raising Return: ID of a window that was used to open URL @@ -91,7 +88,7 @@ def get_window(via_ipc, force_window=False, force_tab=False, window.show() should_raise = True - if (force_raise is True) or (force_raise is None and should_raise): + if should_raise and not no_raise: raise_window(window) return window.win_id |