diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 4d4f6380a..2a9662eef 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -847,14 +847,7 @@ class AbstractTab(QWidget): if predict: self.predicted_navigation.emit(url) - def openurl(self, url, *, predict=True, background=False): - """Open the given URL in this tab. - - Arguments: - url: The QUrl to open. - predict: If set to False, predicted_navigation is not emitted. - background: Whether the tab is being opened in the background. - """ + def openurl(self, url, *, predict=True): raise NotImplementedError def reload(self, *, force=False): diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index f0e2b85b6..fb04dc120 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -782,10 +782,15 @@ class WebEngineTab(browsertab.AbstractTab): self.zoom.set_factor(self._saved_zoom) self._saved_zoom = None - def openurl(self, url, *, predict=True, background=False): + def openurl(self, url, *, predict=True): + """Open the given URL in this tab. + + Arguments: + url: The QUrl to open. + predict: If set to False, predicted_navigation is not emitted. + """ # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 - if not background: - self._widget.setFocus() + self._widget.setFocus() self._saved_zoom = self.zoom.factor() self._openurl_prepare(url, predict=predict) self._widget.load(url) diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index 352372ba4..9d5305f10 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -673,11 +673,9 @@ class WebKitTab(browsertab.AbstractTab): settings = widget.settings() settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, True) - # pylint: disable=unused-argument - def openurl(self, url, *, predict=True, background=False): + def openurl(self, url, *, predict=True): self._openurl_prepare(url, predict=predict) self._widget.openurl(url) - # pylint: enable=unused-argument def url(self, requested=False): frame = self._widget.page().mainFrame() diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 0f9efc014..c473f914d 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -477,12 +477,11 @@ class TabbedBrowser(QWidget): idx = self._get_new_tab_idx(related) self.widget.insertTab(idx, tab, "") + if url is not None: + tab.openurl(url) + if background is None: background = config.val.tabs.background - - if url is not None: - tab.openurl(url, background=background) - if background: # Make sure the background tab has the correct initial size. # With a foreground tab, it's going to be resized correctly by the