From f63b95c29860a735f5746a76676cd0fb47b5a60e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 9 Oct 2017 06:49:27 +0200 Subject: [PATCH] Fix the window.hide_wayland_decoration setting Fixes #2267 --- doc/changelog.asciidoc | 1 + qutebrowser/app.py | 4 ---- qutebrowser/config/configinit.py | 5 +++++ tests/unit/config/test_configinit.py | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index b1b0d3411..abd454bae 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -94,6 +94,7 @@ Fixes insert mode anymore. - The keybinding help widget now works correctly when using keybindings with a count. +- The `window.hide_wayland_decoration setting now works correctly again. v0.11.1 (unreleased) -------------------- diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 7395adc0c..fcb3a8ae5 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -473,10 +473,6 @@ def _init_modules(args, crash_handler): objreg.register('cache', diskcache) log.init.debug("Misc initialization...") - if config.val.window.hide_wayland_decoration: - os.environ['QT_WAYLAND_DISABLE_WINDOWDECORATION'] = '1' - else: - os.environ.pop('QT_WAYLAND_DISABLE_WINDOWDECORATION', None) macros.init() # Init backend-specific stuff browsertab.init() diff --git a/qutebrowser/config/configinit.py b/qutebrowser/config/configinit.py index 209e6428d..20e1a371e 100644 --- a/qutebrowser/config/configinit.py +++ b/qutebrowser/config/configinit.py @@ -80,6 +80,11 @@ def early_init(args): config.val.force_software_rendering): os.environ['QT_XCB_FORCE_SOFTWARE_OPENGL'] = '1' + if config.val.window.hide_wayland_decoration: + os.environ['QT_WAYLAND_DISABLE_WINDOWDECORATION'] = '1' + else: + os.environ.pop('QT_WAYLAND_DISABLE_WINDOWDECORATION', None) + def get_backend(args): """Find out what backend to use based on available libraries.""" diff --git a/tests/unit/config/test_configinit.py b/tests/unit/config/test_configinit.py index 3a1fe8d13..9ef920061 100644 --- a/tests/unit/config/test_configinit.py +++ b/tests/unit/config/test_configinit.py @@ -209,6 +209,23 @@ class TestEarlyInit: assert os.environ[envvar] == '1' + @pytest.mark.parametrize('old', ['1', '0', None]) + @pytest.mark.parametrize('configval', [True, False]) + def test_hide_wayland_decoration(self, monkeypatch, init_patch, args, + old, configval): + envvar = 'QT_WAYLAND_DISABLE_WINDOWDECORATION' + if old is None: + monkeypatch.delenv(envvar, raising=False) + else: + monkeypatch.setenv(envvar, old) + + args.temp_settings = [('window.hide_wayland_decoration', + str(configval))] + configinit.early_init(args) + + expected = '1' if configval else None + assert os.environ.get(envvar) == expected + @pytest.mark.parametrize('errors', [True, False]) def test_late_init(init_patch, monkeypatch, fake_save_manager, args,