summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2020-11-20 17:44:25 +0100
committerFlorian Bruhin <me@the-compiler.org>2020-11-20 18:00:21 +0100
commita46b6224a1aab46717b5e5ad04d81574caa74415 (patch)
tree43a741d0e0910ed630f42faa99288f7fcd091913
parentb9a059624cec6aabe3fa99ba72c4daab0dedfd91 (diff)
downloadqutebrowser-a46b6224a1aab46717b5e5ad04d81574caa74415.tar.gz
qutebrowser-a46b6224a1aab46717b5e5ad04d81574caa74415.zip
Add a setting for window transparency
On some setups, it looks like setting WA_TranslucentBackground causes worse performance. Additionally, it also breaks dmenu window embedding with its `-w` flag. This adds a setting to make it optional. I originally tried to set this in a config change handler, but even with a subsequent .hide()/.show(), for some odd reason that causes rendering/repainting artifacts, possibly due to a Qt bug. Follow-up to #5546 Closes #5805 (cherry picked from commit 50cd6aa6388817ae1cc3e31c420ea7746a5bb182)
-rw-r--r--doc/help/settings.asciidoc17
-rw-r--r--qutebrowser/config/configdata.yml13
-rw-r--r--qutebrowser/mainwindow/mainwindow.py6
3 files changed, 34 insertions, 2 deletions
diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc
index 7c6134cc1..806d608ff 100644
--- a/doc/help/settings.asciidoc
+++ b/doc/help/settings.asciidoc
@@ -327,6 +327,7 @@
|<<url.yank_ignored_parameters,url.yank_ignored_parameters>>|URL parameters to strip with `:yank url`.
|<<window.hide_decoration,window.hide_decoration>>|Hide the window decoration.
|<<window.title_format,window.title_format>>|Format to use for the window title. The same placeholders like for
+|<<window.transparent,window.transparent>>|Set the main window background to transparent.
|<<zoom.default,zoom.default>>|Default zoom level.
|<<zoom.levels,zoom.levels>>|Available zoom levels.
|<<zoom.mouse_divider,zoom.mouse_divider>>|Number of zoom increments to divide the mouse wheel movements to.
@@ -4234,6 +4235,22 @@ Type: <<types,FormatString>>
Default: +pass:[{perc}{current_title}{title_sep}qutebrowser]+
+[[window.transparent]]
+=== window.transparent
+Set the main window background to transparent.
+
+This allows having a transparent tab- or statusbar (might require a compositor such
+as picom). However, it breaks some functionality such as dmenu embedding via its
+`-w` option. On some systems, it was additionally reported that main window
+transparency negatively affects performance.
+
+Note this setting only affects windows opened after setting it.
+
+
+Type: <<types,Bool>>
+
+Default: +pass:[false]+
+
[[zoom.default]]
=== zoom.default
Default zoom level.
diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml
index 6407eea28..5ca683355 100644
--- a/qutebrowser/config/configdata.yml
+++ b/qutebrowser/config/configdata.yml
@@ -2101,6 +2101,19 @@ window.title_format:
Format to use for the window title. The same placeholders like for
`tabs.title.format` are defined.
+window.transparent:
+ type: Bool
+ default: false
+ desc: |
+ Set the main window background to transparent.
+
+ This allows having a transparent tab- or statusbar (might require a compositor such
+ as picom). However, it breaks some functionality such as dmenu embedding via its
+ `-w` option. On some systems, it was additionally reported that main window
+ transparency negatively affects performance.
+
+ Note this setting only affects windows opened after setting it.
+
## zoom
zoom.default:
diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py
index ec9f96411..db4881d15 100644
--- a/qutebrowser/mainwindow/mainwindow.py
+++ b/qutebrowser/mainwindow/mainwindow.py
@@ -203,8 +203,10 @@ class MainWindow(QWidget):
from qutebrowser.mainwindow.statusbar import bar
self.setAttribute(Qt.WA_DeleteOnClose)
- self.setAttribute(Qt.WA_TranslucentBackground)
- self.palette().setColor(QPalette.Window, Qt.transparent)
+ if config.val.window.transparent:
+ self.setAttribute(Qt.WA_TranslucentBackground)
+ self.palette().setColor(QPalette.Window, Qt.transparent)
+
self._overlays = [] # type: typing.MutableSequence[_OverlayInfoType]
self.win_id = next(win_id_gen)
self.registry = objreg.ObjectRegistry()