summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/changelog.asciidoc2
-rw-r--r--doc/help/settings.asciidoc28
-rw-r--r--qutebrowser/browser/downloads.py2
-rw-r--r--qutebrowser/browser/navigate.py2
-rw-r--r--qutebrowser/completion/models/urlmodel.py2
-rw-r--r--qutebrowser/config/configdata.yml46
-rw-r--r--qutebrowser/config/qtargs.py6
-rw-r--r--scripts/dev/pylint_checkers/qute_pylint/config.py25
-rw-r--r--tests/unit/config/test_configfiles.py4
-rw-r--r--tests/unit/config/test_qtargs.py41
10 files changed, 128 insertions, 30 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc
index 24005bae3..3ba7213b3 100644
--- a/doc/changelog.asciidoc
+++ b/doc/changelog.asciidoc
@@ -71,6 +71,8 @@ Added
- New settings for the ABP-based adblocker:
* `content.blocking.method` to decide which blocker(s) should be used.
* `content.blocking.adblock.lists` to configure ABP-like lists to use.
+- New `qt.environ` setting which makes it easier to set/unset environment
+ variables for qutebrowser.
- When QtWebEngine has been updated but PyQtWebEngine hasn't yet, the dark mode
settings might stop working. As a (currently undocumented) escape hatch, this
version adds a `QUTE_DARKMODE_VARIANT=qt_515_2` environment variable which can
diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc
index b1666b2c2..5d48cf420 100644
--- a/doc/help/settings.asciidoc
+++ b/doc/help/settings.asciidoc
@@ -271,6 +271,7 @@
|<<prompt.filebrowser,prompt.filebrowser>>|Show a filebrowser in download prompts.
|<<prompt.radius,prompt.radius>>|Rounding radius (in pixels) for the edges of prompts.
|<<qt.args,qt.args>>|Additional arguments to pass to Qt, without leading `--`.
+|<<qt.environ,qt.environ>>|Additional environment variables to set.
|<<qt.force_platform,qt.force_platform>>|Force a Qt platform to use.
|<<qt.force_platformtheme,qt.force_platformtheme>>|Force a Qt platformtheme to use.
|<<qt.force_software_rendering,qt.force_software_rendering>>|Force software rendering for QtWebEngine.
@@ -372,9 +373,9 @@ Default: +pass:[false]+
[[backend]]
=== backend
Backend to use to display websites.
-qutebrowser supports two different web rendering engines / backends, QtWebKit and QtWebEngine.
-QtWebKit 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. It's slightly more resource hungry than QtWebKit and has a couple of missing features in qutebrowser, but is generally the preferred choice.
+qutebrowser supports two different web rendering engines / backends, QtWebEngine and QtWebKit (not recommended).
+QtWebEngine is Qt's official successor to QtWebKit, and both the default/recommended backend. It's based on a stripped-down Chromium and regularly updated with security fixes and new features by the Qt project: https://wiki.qt.io/QtWebEngine
+QtWebKit was qutebrowser's original backend when the project was started. However, support for QtWebKit was discontinued by the Qt project with Qt 5.6 in 2016. The development of QtWebKit was picked up in an official fork: https://github.com/qtwebkit/qtwebkit - however, the project seems to have stalled again. The latest release (5.212.0 Alpha 4) from March 2020 is based on a WebKit version from 2016, with many known security vulnerabilities. Additionally, there is no process isolation and sandboxing. Due to all those issues, while support for QtWebKit is still available in qutebrowser for now, using it is strongly discouraged.
This setting requires a restart.
@@ -382,8 +383,8 @@ Type: <<types,String>>
Valid values:
- * +webengine+: Use QtWebEngine (based on Chromium).
- * +webkit+: Use QtWebKit (based on WebKit, similar to Safari).
+ * +webengine+: Use QtWebEngine (based on Chromium - recommended).
+ * +webkit+: Use QtWebKit (based on WebKit, similar to Safari - many known security issues!).
Default: +pass:[webengine]+
@@ -1911,6 +1912,12 @@ List of URLs to ABP-style adblocking rulesets.
Only used when Brave's ABP-style adblocker is used (see `content.blocking.method`).
+You can find an overview of available lists here:
+https://adblockplus.org/en/subscriptions - note that the special
+`subscribe.adblockplus.org` links aren't handled by qutebrowser, you will instead
+need to find the link to the raw `.txt` file (e.g. by extracting it from the
+`location` parameter of the subscribe URL and URL-decoding it).
+
Type: <<types,List of Url>>
@@ -3465,6 +3472,17 @@ Type: <<types,List of String>>
Default: empty
+[[qt.environ]]
+=== qt.environ
+Additional environment variables to set.
+Setting an environment variable to null/None will unset it.
+
+This setting requires a restart.
+
+Type: <<types,Dict>>
+
+Default: empty
+
[[qt.force_platform]]
=== qt.force_platform
Force a Qt platform to use.
diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py
index b179013fc..67df2e70d 100644
--- a/qutebrowser/browser/downloads.py
+++ b/qutebrowser/browser/downloads.py
@@ -548,12 +548,10 @@ class AbstractDownloadItem(QObject):
position: The color type requested, can be 'fg' or 'bg'.
"""
assert position in ["fg", "bg"]
- # pylint: disable=bad-config-option
start = getattr(config.val.colors.downloads.start, position)
stop = getattr(config.val.colors.downloads.stop, position)
system = getattr(config.val.colors.downloads.system, position)
error = getattr(config.val.colors.downloads.error, position)
- # pylint: enable=bad-config-option
if self.error_msg is not None:
assert not self.successful
return error
diff --git a/qutebrowser/browser/navigate.py b/qutebrowser/browser/navigate.py
index bace6fa6a..f41c968c0 100644
--- a/qutebrowser/browser/navigate.py
+++ b/qutebrowser/browser/navigate.py
@@ -174,9 +174,7 @@ def _find_prevnext(prev, elems):
if not elems:
return None
- # pylint: disable=bad-config-option
for regex in getattr(config.val.hints, option):
- # pylint: enable=bad-config-option
log.hints.vdebug( # type: ignore[attr-defined]
"== Checking regex '{}'.".format(regex.pattern))
for e in elems:
diff --git a/qutebrowser/completion/models/urlmodel.py b/qutebrowser/completion/models/urlmodel.py
index ba0857d4c..1de336015 100644
--- a/qutebrowser/completion/models/urlmodel.py
+++ b/qutebrowser/completion/models/urlmodel.py
@@ -67,14 +67,12 @@ def url(*, info):
"""
model = completionmodel.CompletionModel(column_widths=(40, 50, 10))
- # pylint: disable=bad-config-option
quickmarks = [(url, name) for (name, url)
in objreg.get('quickmark-manager').marks.items()]
bookmarks = objreg.get('bookmark-manager').marks.items()
searchengines = [(k, v) for k, v
in sorted(config.val.url.searchengines.items())
if k != 'DEFAULT']
- # pylint: enable=bad-config-option
categories = config.val.completion.open_categories
models: Dict[str, QAbstractItemModel] = {}
diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml
index 6eb65dce7..7c18c9847 100644
--- a/qutebrowser/config/configdata.yml
+++ b/qutebrowser/config/configdata.yml
@@ -118,23 +118,30 @@ backend:
type:
name: String
valid_values:
- - webengine: Use QtWebEngine (based on Chromium).
- - webkit: Use QtWebKit (based on WebKit, similar to Safari).
+ - webengine: "Use QtWebEngine (based on Chromium - recommended)."
+ - webkit: "Use QtWebKit (based on WebKit, similar to Safari - many known security
+ issues!)."
default: webengine
restart: true
desc: >-
Backend to use to display websites.
qutebrowser supports two different web rendering engines / backends,
- QtWebKit and QtWebEngine.
+ QtWebEngine and QtWebKit (not recommended).
- QtWebKit 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 both the default/recommended
+ backend. It's based on a stripped-down Chromium and regularly updated with security
+ fixes and new features by the Qt project: https://wiki.qt.io/QtWebEngine
- QtWebEngine is Qt's official successor to QtWebKit. It's slightly more
- resource hungry than QtWebKit and has a couple of missing features in
- qutebrowser, but is generally the preferred choice.
+ QtWebKit was qutebrowser's original backend when the project was started. However,
+ support for QtWebKit was discontinued by the Qt project with Qt 5.6 in 2016. The
+ development of QtWebKit was picked up in an official fork:
+ https://github.com/qtwebkit/qtwebkit - however, the project seems to have stalled
+ again. The latest release (5.212.0 Alpha 4) from March 2020 is based on a WebKit
+ version from 2016, with many known security vulnerabilities. Additionally, there is
+ no process isolation and sandboxing. Due to all those issues, while support for
+ QtWebKit is still available in qutebrowser for now, using it is strongly
+ discouraged.
## qt
@@ -156,6 +163,21 @@ qt.args:
https://peter.sh/experiments/chromium-command-line-switches/ for a list)
will work.
+qt.environ:
+ type:
+ name: Dict
+ keytype: String
+ valtype:
+ name: String
+ none_ok: true
+ none_ok: true
+ default: {}
+ restart: true
+ desc: >-
+ Additional environment variables to set.
+
+ Setting an environment variable to null/None will unset it.
+
force_software_rendering:
renamed: qt.force_software_rendering
@@ -660,6 +682,12 @@ content.blocking.adblock.lists:
Only used when Brave's ABP-style adblocker is used (see `content.blocking.method`).
+ You can find an overview of available lists here:
+ https://adblockplus.org/en/subscriptions - note that the special
+ `subscribe.adblockplus.org` links aren't handled by qutebrowser, you will instead
+ need to find the link to the raw `.txt` file (e.g. by extracting it from the
+ `location` parameter of the subscribe URL and URL-decoding it).
+
content.blocking.whitelist:
default: []
type:
diff --git a/qutebrowser/config/qtargs.py b/qutebrowser/config/qtargs.py
index 2136f7e7f..d6375f331 100644
--- a/qutebrowser/config/qtargs.py
+++ b/qutebrowser/config/qtargs.py
@@ -259,3 +259,9 @@ def init_envvars() -> None:
if qtutils.version_check('5.14', compiled=False)
else 'QT_AUTO_SCREEN_SCALE_FACTOR')
os.environ[env_var] = '1'
+
+ for var, val in config.val.qt.environ.items():
+ if val is None and var in os.environ:
+ del os.environ[var]
+ elif val is not None:
+ os.environ[var] = val
diff --git a/scripts/dev/pylint_checkers/qute_pylint/config.py b/scripts/dev/pylint_checkers/qute_pylint/config.py
index 097b8ada3..7eedeb215 100644
--- a/scripts/dev/pylint_checkers/qute_pylint/config.py
+++ b/scripts/dev/pylint_checkers/qute_pylint/config.py
@@ -49,13 +49,24 @@ class ConfigChecker(checkers.BaseChecker):
@utils.check_messages('bad-config-option')
def visit_attribute(self, node):
"""Visit a getattr node."""
- # At the end of a config.val.foo.bar chain
- if not isinstance(node.parent, astroid.Attribute):
- # FIXME:conf do some proper check for this...
- node_str = node.as_string()
- prefix = 'config.val.'
- if node_str.startswith(prefix):
- self._check_config(node, node_str[len(prefix):])
+ # We're only interested in the end of a config.val.foo.bar chain
+ if isinstance(node.parent, astroid.Attribute):
+ return
+
+ if isinstance(node.parent, astroid.Call):
+ # Skip dynamic getattr()
+ func = node.parent.func
+ if isinstance(func, astroid.Name) and func.name == 'getattr':
+ return
+ # Handle .items() / .values()
+ if node.attrname in ['items', 'values']:
+ node = node.expr
+
+ # FIXME:conf do some proper check for this...
+ node_str = node.as_string()
+ prefix = 'config.val.'
+ if node_str.startswith(prefix):
+ self._check_config(node, node_str[len(prefix):])
def _check_config(self, node, name):
"""Check that we're accessing proper config options."""
diff --git a/tests/unit/config/test_configfiles.py b/tests/unit/config/test_configfiles.py
index 11808e2c2..a21fa4e71 100644
--- a/tests/unit/config/test_configfiles.py
+++ b/tests/unit/config/test_configfiles.py
@@ -808,9 +808,7 @@ class TestConfigPy:
])
def test_get(self, confpy, set_first, get_line):
"""Test whether getting options works correctly."""
- # pylint: disable=bad-config-option
- config.val.colors.hints.fg = 'green'
- # pylint: enable=bad-config-option
+ config.val.colors.hints.fg = 'green' # pylint: disable=bad-config-option
if set_first:
confpy.write('c.colors.hints.fg = "red"',
'assert {} == "red"'.format(get_line))
diff --git a/tests/unit/config/test_qtargs.py b/tests/unit/config/test_qtargs.py
index b050113b4..b38fab41d 100644
--- a/tests/unit/config/test_qtargs.py
+++ b/tests/unit/config/test_qtargs.py
@@ -428,6 +428,47 @@ class TestEnvVars:
assert os.environ[envvar] == expected
+ @pytest.mark.parametrize('init_val, config_val', [
+ ( # Test changing a set variable
+ {'QT_SCALE_FACTOR': '2'},
+ {'QT_SCALE_FACTOR': '4'},
+ ),
+ ( # Test setting an unset variable
+ {'QT_SCALE_FACTOR': None},
+ {'QT_SCALE_FACTOR': '3'},
+ ),
+ ( # Test unsetting a variable which is set
+ {'QT_SCALE_FACTOR': '3'},
+ {'QT_SCALE_FACTOR': None},
+ ),
+ ( # Test unsetting a variable which is unset
+ {'QT_SCALE_FACTOR': None},
+ {'QT_SCALE_FACTOR': None},
+ ),
+ ( # Test setting multiple variables
+ {'QT_SCALE_FACTOR': '0', 'QT_PLUGIN_PATH': '/usr/bin', 'QT_NEWVAR': None},
+ {'QT_SCALE_FACTOR': '3', 'QT_PLUGIN_PATH': '/tmp/', 'QT_NEWVAR': 'newval'},
+ )
+ ])
+ def test_environ_settings(self, monkeypatch, config_stub,
+ init_val, config_val):
+ """Test setting environment variables using qt.environ."""
+ for var, val in init_val.items():
+ if val is None:
+ monkeypatch.setenv(var, '0')
+ monkeypatch.delenv(var, raising=False)
+ else:
+ monkeypatch.setenv(var, val)
+
+ config_stub.val.qt.environ = config_val
+ qtargs.init_envvars()
+
+ for var, result in config_val.items():
+ if result is None:
+ assert var not in os.environ
+ else:
+ assert os.environ[var] == result
+
@pytest.mark.parametrize('new_qt', [True, False])
def test_highdpi(self, monkeypatch, config_stub, new_qt):
"""Test HighDPI environment variables.