From b1b6c462c1a8a30abf37c4d785e5cc9925385b31 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 18 Sep 2017 22:59:33 +0200 Subject: [PATCH] Add a backend setting See #2589 --- doc/changelog.asciidoc | 3 +++ doc/help/settings.asciidoc | 18 ++++++++++++++++++ qutebrowser/config/config.py | 13 ++++++++----- qutebrowser/config/configdata.yml | 22 ++++++++++++++++++++++ 4 files changed, 51 insertions(+), 5 deletions(-) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index cdbdff015..9cd0c4792 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -51,6 +51,9 @@ Added - New back/forward indicator in the statusbar - New `bindings.key_mappings` setting to map keys to other keys - New `qt_args` setting to pass additional arguments to Qt/Chromium +- New `backend` setting to select the backend to use (auto/webengine/webkit). + Together with the previous setting, this should make wrapper scripts + unnecessary. Changed ~~~~~~~ diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index aff506d7e..907e5d7c1 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -12,6 +12,7 @@ |<>|Aliases for commands. |<>|How often (in milliseconds) to auto-save config/cookies/etc. |<>|Always restore open sites when qutebrowser is reopened. +|<>|The backend to use to display websites. |<>|Keybindings mapping keys to commands in different modes. |<>|Default keybindings. If you want to add bindings, modify `bindings.commands` instead. |<>|This setting can be used to map keys to other keys. @@ -285,6 +286,23 @@ Valid values: Default: empty +[[backend]] +=== backend +The backend to use to display websites. +qutebrowser supports two different web rendering engines / backends, QtWebKit and QtWebEngine. +QtWebKit is based on WebKit (similar to Safari). It was discontinued by the Qt project with Qt 5.6, but picked up as a well maintained fork: https://github.com/annulen/webkit/wiki - qutebrowser only supports the fork. +QtWebEngine is Qt's official successor to QtWebKit and based on the Chromium project. It's slightly more resource hungry that QtWebKit and has a couple of missing features in qutebrowser, but is generally the preferred choice. + +Type: <> + +Valid values: + + * +auto+: Automatically select either QtWebEngine or QtWebKit + * +webkit+: Force QtWebKit + * +webengine+: Force QtWebEngine + +Default: +pass:[auto]+ + [[bindings.commands]] === bindings.commands Keybindings mapping keys to commands in different modes. diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 736b1775c..678417453 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -700,12 +700,15 @@ def get_backend(args): else: webkit_available = qtutils.is_new_qtwebkit() + str_to_backend = { + 'webkit': usertypes.Backend.QtWebKit, + 'webengine': usertypes.Backend.QtWebEngine, + } + if args.backend is not None: - backends = { - 'webkit': usertypes.Backend.QtWebKit, - 'webengine': usertypes.Backend.QtWebEngine, - } - return backends[args.backend] + return str_to_backend[args.backend] + elif val.backend != 'auto': + return str_to_backend[val.backend] elif webkit_available: return usertypes.Backend.QtWebKit else: diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 1ff02c3b8..8504c224e 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -101,6 +101,28 @@ qt_args: https://peter.sh/experiments/chromium-command-line-switches/ for a list) will work. +backend: + type: + name: String + valid_values: + - auto: Automatically select either QtWebEngine or QtWebKit + - webkit: Force QtWebKit + - webengine: Force QtWebEngine + default: auto + desc: >- + The backend to use to display websites. + + qutebrowser supports two different web rendering engines / backends, + QtWebKit and QtWebEngine. + + QtWebKit is based on WebKit (similar to Safari). It was discontinued by the + Qt project with Qt 5.6, but picked up as a well maintained fork: + https://github.com/annulen/webkit/wiki - qutebrowser only supports the fork. + + QtWebEngine is Qt's official successor to QtWebKit and based on the Chromium + project. It's slightly more resource hungry that QtWebKit and has a couple + of missing features in qutebrowser, but is generally the preferred choice. + ## auto_save auto_save.interval: