From 0de0451d6bfdea830fc5bd79ff538f6624e7cde3 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 3 Dec 2020 14:31:44 +0100 Subject: Minor changes to dark color preference (cherry picked from commit 86d871038034fe1a627241741e39eceecb12614c) --- qutebrowser/config/qtargs.py | 8 ++++++-- tests/end2end/test_invocations.py | 3 +-- tests/unit/config/test_qtargs.py | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/qutebrowser/config/qtargs.py b/qutebrowser/config/qtargs.py index 0afea7196..06df54a2f 100644 --- a/qutebrowser/config/qtargs.py +++ b/qutebrowser/config/qtargs.py @@ -81,8 +81,12 @@ def _darkmode_settings() -> typing.Iterator[typing.Tuple[str, str]]: """Get necessary blink settings to configure dark mode for QtWebEngine.""" if (qtutils.version_check('5.15.2', compiled=False) and config.val.colors.webpage.prefers_color_scheme_dark): - # In future versions of 'blink', (> Qt 5.15.2) the enumeration has - # changed and this will need to be set to '0' instead. + # With older Qt versions, this is passed in qtargs.py as --force-dark-mode + # instead. + # + # With Chromium 85 (> Qt 5.15.2), the enumeration has changed in Blink and this + # will need to be set to '0' instead: + # https://chromium-review.googlesource.com/c/chromium/src/+/2232922 yield "preferredColorScheme", "1" if not config.val.colors.webpage.darkmode.enabled: diff --git a/tests/end2end/test_invocations.py b/tests/end2end/test_invocations.py index 03b6b798f..8460c888c 100644 --- a/tests/end2end/test_invocations.py +++ b/tests/end2end/test_invocations.py @@ -417,6 +417,5 @@ def test_preferred_colorscheme(request, quteproc_new): ] quteproc_new.start(args) - quteproc_new.send_cmd(':jseval ' - 'matchMedia("(prefers-color-scheme: dark)").matches') + quteproc_new.send_cmd(':jseval matchMedia("(prefers-color-scheme: dark)").matches') quteproc_new.wait_for(message='True') diff --git a/tests/unit/config/test_qtargs.py b/tests/unit/config/test_qtargs.py index 782444da6..718ffff9b 100644 --- a/tests/unit/config/test_qtargs.py +++ b/tests/unit/config/test_qtargs.py @@ -318,11 +318,12 @@ class TestQtArgs: assert arg in args @pytest.mark.parametrize('dark, qt_version, added', [ - (True, "5.13", False), + (True, "5.13", False), # not supported (True, "5.14", True), (True, "5.15.0", True), (True, "5.15.1", True), - (True, "5.15.2", False), + (True, "5.15.2", False), # handled via blink setting + (False, "5.13", False), (False, "5.14", False), (False, "5.15.0", False), -- cgit v1.2.3-54-g00ecf