Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

background tabs are not background, if tabs are windows #3819

Open
eike-fokken opened this issue Apr 5, 2018 · 4 comments
Open

background tabs are not background, if tabs are windows #3819

eike-fokken opened this issue Apr 5, 2018 · 4 comments
Labels
component: ui Issues related to the user interface. priority: 2 - low Issues which are currently not very important.

Comments

@eike-fokken
Copy link

eike-fokken commented Apr 5, 2018

My settings are

Window manager: i3 version 4.15 (2018-03-10)
qutebrowser v1.2.1

Backend: QtWebEngine (Chromium 56.0.2924.122)

CPython: 3.6.5rc1
Qt: 5.9.2
PyQt: 5.9.2

sip: 4.19.8
colorama: no
pypeg2: 2.15
jinja2: 2.10
pygments: 2.2.0
yaml: 3.12
cssutils: no
attr: 17.4.0
PyQt5.QtWebEngineWidgets: yes
PyQt5.QtWebKitWidgets: no
pdf.js: no
sqlite: 3.22.0
QtNetwork SSL: OpenSSL 1.0.2o  27 Mar 2018

Style: QFusionStyle
Platform: Linux-4.15.0-2-amd64-x86_64-with-debian-buster-sid, 64bit
Linux distribution: Debian GNU/Linux buster/sid (debian)
Frozen: False
Imported from /usr/lib/python3/dist-packages/qutebrowser
Qt library executable path: /usr/lib/x86_64-linux-gnu/qt5/libexec, data path: /usr/share/qt5

I have these settings:
c.tabs.show = 'never'
c.tabs.tabs_are_windows = True

When I run
:open -b gnu.org

it opens gnu.org in a new window but focuses this new window.
I would like it to keep focus on the current window.

Is this possible from within qutebrowser or is it an issue of the window manager (i3wm)?

The same (and more relevant) happens when I try to open a hint in background tab with
;b

Best
Eike

@qutebrowser-bot qutebrowser-bot added bug: behavior Something doesn't work as intended, but doesn't crash. component: QtWebEngine Issues related to the QtWebEngine backend, based on Chromium. labels Apr 5, 2018
@jgkamat jgkamat added component: ui Issues related to the user interface. and removed component: QtWebEngine Issues related to the QtWebEngine backend, based on Chromium. labels Apr 5, 2018
@jgkamat
Copy link
Member

jgkamat commented Apr 5, 2018

I think this is a duplicate of #818 (and because of that, an issue in the WM).

@jgkamat jgkamat removed the bug: behavior Something doesn't work as intended, but doesn't crash. label Apr 6, 2018
@The-Compiler The-Compiler added the status: needs triage Issues/PRs which need some deeper investigation. label Apr 10, 2018
@The-Compiler
Copy link
Member

The-Compiler commented May 9, 2018

Related patch from the ML:

From: Eike Fokken <ef...n@posteo.de>
Date: Fri, 13 Apr 2018 14:06:02 +0200
Subject: [PATCH] Adds the window_role "qutebrowser_background" for background
 windows

For some users it may be the desired behaviour that non-background
windows grab focus on creation, but background windows don't. To make
this possible without interfering with window manager settings this
task is left to the window manager. To make it recognize background
windows, they are given a special window role.
For example in i3 one can then set

no_focus [window_role= "qutebrowser_background"]

to disable focus grabbing only for background windows.
---
 qutebrowser/mainwindow/tabbedbrowser.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py
index ce36f0038..313dfde01 100644
--- a/qutebrowser/mainwindow/tabbedbrowser.py
+++ b/qutebrowser/mainwindow/tabbedbrowser.py
@@ -458,9 +458,14 @@ class TabbedBrowser(QWidget):
                           "related {}, idx {}".format(
                               url, background, related, idx))

+        if background is None:
+            background = config.val.tabs.background
+
         if (config.val.tabs.tabs_are_windows and self.widget.count() > 0 and
                 not ignore_tabs_are_windows):
             window = mainwindow.MainWindow(private=self.private)
+            if background:
+                window.setWindowRole("qutebrowser_background")
             window.show()
             tabbed_browser = objreg.get('tabbed-browser', scope='window',
                                         window=window.win_id)
@@ -478,8 +483,6 @@ class TabbedBrowser(QWidget):
         if url is not None:
             tab.openurl(url)

-        if background is None:
-            background = config.val.tabs.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
--
2.17.0

@The-Compiler The-Compiler added priority: 2 - low Issues which are currently not very important. and removed status: needs triage Issues/PRs which need some deeper investigation. labels May 9, 2018
@The-Compiler
Copy link
Member

FWIW, ICCM says:

The client must set the WM_WINDOW_ROLE property to a string that uniquely identifies that window among all windows that have the same client leader window.

So abusing setWindowRole to tell foreground/background windows apart seems like quite a hack with a possibility to break other things depending on the window manager.

@eike-fokken
Copy link
Author

eike-fokken commented Jun 7, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ui Issues related to the user interface. priority: 2 - low Issues which are currently not very important.
Projects
None yet
Development

No branches or pull requests

4 participants