diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 6399b88af..dbee21b8f 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -264,7 +264,7 @@ |<>|Search engines which can be used via the address bar. |<>|Page(s) to open at the start. |<>|URL parameters to strip with `:yank url`. -|<>|Hide the window decoration when using wayland. +|<>|Hide the window decoration. |<>|Format to use for the window title. The same placeholders like for |<>|Default zoom level. |<>|Available zoom levels. @@ -3157,9 +3157,9 @@ Default: - +pass:[utm_term]+ - +pass:[utm_content]+ -[[window.hide_wayland_decoration]] -=== window.hide_wayland_decoration -Hide the window decoration when using wayland. +[[window.hide_decoration]] +=== window.hide_decoration +Hide the window decoration. This setting requires a restart. Type: <> diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 35b514880..bbc49b374 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -1534,10 +1534,15 @@ url.yank_ignored_parameters: ## window window.hide_wayland_decoration: + renamed: window.hide_decoration + +window.hide_decoration: type: Bool default: false - restart: true - desc: Hide the window decoration when using wayland. + restart: false + desc: | + Hide the window decoration. Does require a restart for + Wayland users. window.title_format: type: diff --git a/qutebrowser/config/configinit.py b/qutebrowser/config/configinit.py index 5c06a4a3d..1f9f0f4b6 100644 --- a/qutebrowser/config/configinit.py +++ b/qutebrowser/config/configinit.py @@ -90,7 +90,7 @@ def _init_envvars(): if config.val.qt.force_platform is not None: os.environ['QT_QPA_PLATFORM'] = config.val.qt.force_platform - if config.val.window.hide_wayland_decoration: + if config.val.window.hide_decoration: os.environ['QT_WAYLAND_DISABLE_WINDOWDECORATION'] = '1' if config.val.qt.highdpi: diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 3db56c0a7..596280e81 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -230,6 +230,7 @@ class MainWindow(QWidget): config.instance.changed.connect(self._on_config_changed) objreg.get("app").new_window.emit(self) + self._set_decoration(config.val.window.hide_decoration) def _init_geometry(self, geometry): """Initialize the window geometry or load it from disk.""" @@ -344,6 +345,8 @@ class MainWindow(QWidget): elif option == 'statusbar.position': self._add_widgets() self._update_overlay_geometries() + elif option == 'window.hide_decoration': + self._set_decoration(config.val.window.hide_decoration) def _add_widgets(self): """Add or readd all widgets to the VBox.""" @@ -493,6 +496,16 @@ class MainWindow(QWidget): completion_obj.on_clear_completion_selection) cmd.hide_completion.connect(completion_obj.hide) + def _set_decoration(self, hidden): + """Set the visibility of the window decoration via Qt.""" + window_flags = Qt.Window + refresh_window = self.isVisible() + if hidden: + window_flags |= Qt.CustomizeWindowHint | Qt.NoDropShadowWindowHint + self.setWindowFlags(window_flags) + if refresh_window: + self.show() + @pyqtSlot(bool) def _on_fullscreen_requested(self, on): if not config.val.content.windowed_fullscreen: diff --git a/tests/unit/config/test_configinit.py b/tests/unit/config/test_configinit.py index 2ee572860..6f3f0e1e5 100644 --- a/tests/unit/config/test_configinit.py +++ b/tests/unit/config/test_configinit.py @@ -292,7 +292,7 @@ class TestEarlyInit: 'QT_XCB_FORCE_SOFTWARE_OPENGL', '1'), ('qt.force_platform', 'toaster', 'QT_QPA_PLATFORM', 'toaster'), ('qt.highdpi', True, 'QT_AUTO_SCREEN_SCALE_FACTOR', '1'), - ('window.hide_wayland_decoration', True, + ('window.hide_decoration', True, 'QT_WAYLAND_DISABLE_WINDOWDECORATION', '1') ]) def test_env_vars(self, monkeypatch, config_stub,