diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-07-10 11:25:38 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-07-10 11:25:38 +0200 |
commit | ebf4b987ecb6c239af91bb44235567c30e288d71 (patch) | |
tree | 3fc3f360afded882d906c9193fb58a63888efbbd | |
parent | de4a1c1a2839b5b49c3d4ce21d39de48d24e2091 (diff) | |
download | qutebrowser-ebf4b987ecb6c239af91bb44235567c30e288d71.tar.gz qutebrowser-ebf4b987ecb6c239af91bb44235567c30e288d71.zip |
qtargs: Move --enabled-features handling to separate function
Preparation for proper handling as part of #5421
-rw-r--r-- | qutebrowser/config/qtargs.py | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/qutebrowser/config/qtargs.py b/qutebrowser/config/qtargs.py index 8a8d40dc4..2a8f52269 100644 --- a/qutebrowser/config/qtargs.py +++ b/qutebrowser/config/qtargs.py @@ -139,6 +139,23 @@ def _darkmode_settings() -> typing.Iterator[typing.Tuple[str, str]]: yield prefix + key, str(value) +def _qtwebengine_enabled_features() -> typing.Iterator[str]: + """Get --enable-features flags for QtWebEngine.""" + if qtutils.version_check('5.11', compiled=False) and not utils.is_mac: + # There are two additional flags in Chromium: + # + # - OverlayScrollbarFlashAfterAnyScrollUpdate + # - OverlayScrollbarFlashWhenMouseEnter + # + # We don't expose/activate those, but the changes they introduce are + # quite subtle: The former seems to show the scrollbar handle even if + # there was a 0px scroll (though no idea how that can happen...). The + # latter flashes *all* scrollbars when a scrollable area was entered, + # which doesn't seem to make much sense. + if config.val.scrolling.bar == 'overlay': + yield 'OverlayScrollbar' + + def _qtwebengine_args(namespace: argparse.Namespace) -> typing.Iterator[str]: """Get the QtWebEngine arguments to use based on the config.""" is_qt_514 = (qtutils.version_check('5.14', compiled=False) and @@ -175,6 +192,10 @@ def _qtwebengine_args(namespace: argparse.Namespace) -> typing.Iterator[str]: yield '--blink-settings=' + ','.join('{}={}'.format(k, v) for k, v in blink_settings) + enabled_features = list(_qtwebengine_enabled_features()) + if enabled_features: + yield '--enable-features=' + ','.join(enabled_features) + settings = { 'qt.force_software_rendering': { 'software-opengl': None, @@ -222,24 +243,6 @@ def _qtwebengine_args(namespace: argparse.Namespace) -> typing.Iterator[str]: False: '--autoplay-policy=user-gesture-required', } - if qtutils.version_check('5.11', compiled=False) and not utils.is_mac: - # There are two additional flags in Chromium: - # - # - OverlayScrollbarFlashAfterAnyScrollUpdate - # - OverlayScrollbarFlashWhenMouseEnter - # - # We don't expose/activate those, but the changes they introduce are - # quite subtle: The former seems to show the scrollbar handle even if - # there was a 0px scroll (though no idea how that can happen...). The - # latter flashes *all* scrollbars when a scrollable area was entered, - # which doesn't seem to make much sense. - settings['scrolling.bar'] = { - 'always': None, - 'never': None, - 'when-searching': None, - 'overlay': '--enable-features=OverlayScrollbar', - } - if qtutils.version_check('5.14'): settings['colors.webpage.prefers_color_scheme_dark'] = { True: '--force-dark-mode', |