diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 6399b88af..d81619743 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. @@ -3158,8 +3158,8 @@ Default: - +pass:[utm_content]+ [[window.hide_wayland_decoration]] -=== window.hide_wayland_decoration -Hide the window decoration when using wayland. +=== 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..f41044d35 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -1533,11 +1533,11 @@ url.yank_ignored_parameters: ## window -window.hide_wayland_decoration: +window.hide_decoration: type: Bool default: false restart: true - desc: Hide the window decoration when using wayland. + desc: Hide the window decoration. window.title_format: type: diff --git a/qutebrowser/config/configfiles.py b/qutebrowser/config/configfiles.py index fdb1583e0..b224fe0a2 100644 --- a/qutebrowser/config/configfiles.py +++ b/qutebrowser/config/configfiles.py @@ -262,6 +262,20 @@ class YamlConfig(QObject): del settings[old] self._mark_changed() + # window.hide_wayland_decoration was replaced by a more system agnostic + # Qt based equivalent + old = 'window.hide_wayland_decoration' + new = 'window.hide_decoration' + if old in settings: + settings[new] = {} + for scope, val in settings[old].items(): + if val: + settings[new][scope] = True + else: + settings[new][scope] = False + del settings[old] + self._mark_changed() + # bindings.default can't be set in autoconfig.yml anymore, so ignore # old values. if 'bindings.default' in settings: diff --git a/qutebrowser/config/configinit.py b/qutebrowser/config/configinit.py index 5c06a4a3d..7f40a74fb 100644 --- a/qutebrowser/config/configinit.py +++ b/qutebrowser/config/configinit.py @@ -90,9 +90,6 @@ 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: - os.environ['QT_WAYLAND_DISABLE_WINDOWDECORATION'] = '1' - if config.val.qt.highdpi: os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1' diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 3db56c0a7..dfb2f416b 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -169,6 +169,9 @@ class MainWindow(QWidget): objreg.register('message-bridge', message_bridge, scope='window', window=self.win_id) + if config.val.window.hide_decoration: + window_flags = Qt.CustomizeWindowHint | Qt.NoDropShadowWindowHint + self.setWindowFlags(Qt.Window | window_flags) self.setWindowTitle('qutebrowser') self._vbox = QVBoxLayout(self) self._vbox.setContentsMargins(0, 0, 0, 0) diff --git a/tests/unit/config/test_configfiles.py b/tests/unit/config/test_configfiles.py index 96f5d4976..40eec89d0 100644 --- a/tests/unit/config/test_configfiles.py +++ b/tests/unit/config/test_configfiles.py @@ -223,6 +223,18 @@ class TestYaml: mode = 'persist' if persist else 'normal' assert data['tabs.mode_on_change']['global'] == mode + @pytest.mark.parametrize('hide_decoration', [True, False]) + def test_merge_persist(self, yaml, autoconfig, hide_decoration): + """Tests for migration of window.hide_wayland_decoration""" + old = {'window.hide_wayland_decoration': {'global': hide_decoration}} + autoconfig.write(old) + yaml.load() + yaml._save() + + data = autoconfig.read() + assert 'window.hide_wayland_decoration' not in data + assert data['window.hide_decoration']['global'] == hide_decoration + def test_bindings_default(self, yaml, autoconfig): """Make sure bindings.default gets removed from autoconfig.yml.""" autoconfig.write({'bindings.default': {'global': '{}'}})