Make qutebrowser aware of settings requiring a restart

See #3270
This commit is contained in:
Florian Bruhin 2017-11-12 17:17:19 +01:00
parent c47f0402ab
commit f6e6f9d27b
4 changed files with 16 additions and 15 deletions

View File

@ -254,7 +254,7 @@
|<<url.searchengines,url.searchengines>>|Search engines which can be used via the address bar. |<<url.searchengines,url.searchengines>>|Search engines which can be used via the address bar.
|<<url.start_pages,url.start_pages>>|Page(s) to open at the start. |<<url.start_pages,url.start_pages>>|Page(s) to open at the start.
|<<url.yank_ignored_parameters,url.yank_ignored_parameters>>|URL parameters to strip with `:yank url`. |<<url.yank_ignored_parameters,url.yank_ignored_parameters>>|URL parameters to strip with `:yank url`.
|<<window.hide_wayland_decoration,window.hide_wayland_decoration>>|Hide the window decoration when using wayland (requires restart). |<<window.hide_wayland_decoration,window.hide_wayland_decoration>>|Hide the window decoration when using wayland.
|<<window.title_format,window.title_format>>|Format to use for the window title. The same placeholders like for |<<window.title_format,window.title_format>>|Format to use for the window title. The same placeholders like for
|<<zoom.default,zoom.default>>|Default zoom level. |<<zoom.default,zoom.default>>|Default zoom level.
|<<zoom.levels,zoom.levels>>|Available zoom levels. |<<zoom.levels,zoom.levels>>|Available zoom levels.
@ -2989,7 +2989,8 @@ Default:
[[window.hide_wayland_decoration]] [[window.hide_wayland_decoration]]
=== window.hide_wayland_decoration === window.hide_wayland_decoration
Hide the window decoration when using wayland (requires restart). Hide the window decoration when using wayland.
This setting requires a restart.
Type: <<types,Bool>> Type: <<types,Bool>>

View File

@ -48,6 +48,7 @@ class Option:
backends = attr.ib() backends = attr.ib()
raw_backends = attr.ib() raw_backends = attr.ib()
description = attr.ib() description = attr.ib()
restart = attr.ib(default=False)
@attr.s @attr.s
@ -190,7 +191,7 @@ def _read_yaml(yaml_data):
migrations = Migrations() migrations = Migrations()
data = utils.yaml_load(yaml_data) data = utils.yaml_load(yaml_data)
keys = {'type', 'default', 'desc', 'backend'} keys = {'type', 'default', 'desc', 'backend', 'restart'}
for name, option in data.items(): for name, option in data.items():
if set(option.keys()) == {'renamed'}: if set(option.keys()) == {'renamed'}:
@ -215,7 +216,8 @@ def _read_yaml(yaml_data):
default=option['default'], default=option['default'],
backends=_parse_yaml_backends(name, backends), backends=_parse_yaml_backends(name, backends),
raw_backends=backends if isinstance(backends, dict) else None, raw_backends=backends if isinstance(backends, dict) else None,
description=option['desc']) description=option['desc'],
restart=option.get('restart', False))
# Make sure no key shadows another. # Make sure no key shadows another.
for key1 in parsed: for key1 in parsed:

View File

@ -95,6 +95,7 @@ backend:
- webengine: Use QtWebEngine (based on Chromium). - webengine: Use QtWebEngine (based on Chromium).
- webkit: Use QtWebKit (based on WebKit, similar to Safari). - webkit: Use QtWebKit (based on WebKit, similar to Safari).
default: webengine default: webengine
restart: true
desc: >- desc: >-
Backend to use to display websites. Backend to use to display websites.
@ -109,8 +110,6 @@ backend:
resource hungry than QtWebKit and has a couple of missing features in resource hungry than QtWebKit and has a couple of missing features in
qutebrowser, but is generally the preferred choice. qutebrowser, but is generally the preferred choice.
This setting requires a restart.
## qt ## qt
@ -123,6 +122,7 @@ qt.args:
valtype: String valtype: String
none_ok: true none_ok: true
default: [] default: []
restart: true
desc: >- desc: >-
Additional arguments to pass to Qt, without leading `--`. Additional arguments to pass to Qt, without leading `--`.
@ -130,8 +130,6 @@ qt.args:
https://peter.sh/experiments/chromium-command-line-switches/ for a list) https://peter.sh/experiments/chromium-command-line-switches/ for a list)
will work. will work.
This setting requires a restart.
force_software_rendering: force_software_rendering:
renamed: qt.force_software_rendering renamed: qt.force_software_rendering
@ -139,30 +137,29 @@ qt.force_software_rendering:
type: Bool type: Bool
default: false default: false
backend: QtWebEngine backend: QtWebEngine
restart: true
desc: >- desc: >-
Force software rendering for QtWebEngine. Force software rendering for QtWebEngine.
This is needed for QtWebEngine to work with Nouveau drivers. This is needed for QtWebEngine to work with Nouveau drivers.
This setting requires a restart.
qt.force_platform: qt.force_platform:
type: type:
name: String name: String
none_ok: true none_ok: true
default: null default: null
restart: true
desc: >- desc: >-
Force a Qt platform to use. Force a Qt platform to use.
This sets the `QT_QPA_PLATFORM` environment variable and is useful to force This sets the `QT_QPA_PLATFORM` environment variable and is useful to force
using the XCB plugin when running QtWebEngine on Wayland. using the XCB plugin when running QtWebEngine on Wayland.
This setting requires a restart.
qt.highdpi: qt.highdpi:
type: Bool type: Bool
default: false default: false
restart: true
desc: >- desc: >-
Turn on Qt HighDPI scaling. Turn on Qt HighDPI scaling.
@ -173,8 +170,6 @@ qt.highdpi:
As an alternative to this, it's possible to set font sizes and the As an alternative to this, it's possible to set font sizes and the
`zoom.default` setting. `zoom.default` setting.
This setting requires a restart.
## auto_save ## auto_save
auto_save.interval: auto_save.interval:
@ -1437,7 +1432,8 @@ url.yank_ignored_parameters:
window.hide_wayland_decoration: window.hide_wayland_decoration:
type: Bool type: Bool
default: false default: false
desc: Hide the window decoration when using wayland (requires restart). restart: true
desc: Hide the window decoration when using wayland.
window.title_format: window.title_format:
type: type:

View File

@ -416,6 +416,8 @@ def _generate_setting_option(f, opt):
f.write('[[{}]]'.format(opt.name) + "\n") f.write('[[{}]]'.format(opt.name) + "\n")
f.write("=== {}".format(opt.name) + "\n") f.write("=== {}".format(opt.name) + "\n")
f.write(opt.description + "\n") f.write(opt.description + "\n")
if opt.restart:
f.write("This setting requires a restart.\n")
f.write("\n") f.write("\n")
typ = opt.typ.get_name().replace(',', '&#44;') typ = opt.typ.get_name().replace(',', '&#44;')
f.write('Type: <<types,{typ}>>\n'.format(typ=typ)) f.write('Type: <<types,{typ}>>\n'.format(typ=typ))