General window decoration hiding option

This commit is contained in:
rien333 2018-03-22 02:23:21 +01:00
parent 300d873b18
commit a6b92dbbd3
6 changed files with 34 additions and 8 deletions

View File

@ -264,7 +264,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. |<<window.hide_decoration,window.hide_decoration>>|Hide the window decoration.
|<<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.
@ -3158,8 +3158,8 @@ Default:
- +pass:[utm_content]+ - +pass:[utm_content]+
[[window.hide_wayland_decoration]] [[window.hide_wayland_decoration]]
=== window.hide_wayland_decoration === window.hide_decoration
Hide the window decoration when using wayland. Hide the window decoration.
This setting requires a restart. This setting requires a restart.
Type: <<types,Bool>> Type: <<types,Bool>>

View File

@ -1533,11 +1533,11 @@ url.yank_ignored_parameters:
## window ## window
window.hide_wayland_decoration: window.hide_decoration:
type: Bool type: Bool
default: false default: false
restart: true restart: true
desc: Hide the window decoration when using wayland. desc: Hide the window decoration.
window.title_format: window.title_format:
type: type:

View File

@ -262,6 +262,20 @@ class YamlConfig(QObject):
del settings[old] del settings[old]
self._mark_changed() self._mark_changed()
# window.hide_wayland_decoration was replaced by a more system agnostic
# Qt based equivalent
old = 'window.hide_wayland_decoration'
new = 'window.hide_decoration'
if old in settings:
settings[new] = {}
for scope, val in settings[old].items():
if val:
settings[new][scope] = True
else:
settings[new][scope] = False
del settings[old]
self._mark_changed()
# bindings.default can't be set in autoconfig.yml anymore, so ignore # bindings.default can't be set in autoconfig.yml anymore, so ignore
# old values. # old values.
if 'bindings.default' in settings: if 'bindings.default' in settings:

View File

@ -90,9 +90,6 @@ def _init_envvars():
if config.val.qt.force_platform is not None: if config.val.qt.force_platform is not None:
os.environ['QT_QPA_PLATFORM'] = config.val.qt.force_platform os.environ['QT_QPA_PLATFORM'] = config.val.qt.force_platform
if config.val.window.hide_wayland_decoration:
os.environ['QT_WAYLAND_DISABLE_WINDOWDECORATION'] = '1'
if config.val.qt.highdpi: if config.val.qt.highdpi:
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1' os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'

View File

@ -169,6 +169,9 @@ class MainWindow(QWidget):
objreg.register('message-bridge', message_bridge, scope='window', objreg.register('message-bridge', message_bridge, scope='window',
window=self.win_id) window=self.win_id)
if config.val.window.hide_decoration:
window_flags = Qt.CustomizeWindowHint | Qt.NoDropShadowWindowHint
self.setWindowFlags(Qt.Window | window_flags)
self.setWindowTitle('qutebrowser') self.setWindowTitle('qutebrowser')
self._vbox = QVBoxLayout(self) self._vbox = QVBoxLayout(self)
self._vbox.setContentsMargins(0, 0, 0, 0) self._vbox.setContentsMargins(0, 0, 0, 0)

View File

@ -223,6 +223,18 @@ class TestYaml:
mode = 'persist' if persist else 'normal' mode = 'persist' if persist else 'normal'
assert data['tabs.mode_on_change']['global'] == mode assert data['tabs.mode_on_change']['global'] == mode
@pytest.mark.parametrize('hide_decoration', [True, False])
def test_merge_persist(self, yaml, autoconfig, hide_decoration):
"""Tests for migration of window.hide_wayland_decoration"""
old = {'window.hide_wayland_decoration': {'global': hide_decoration}}
autoconfig.write(old)
yaml.load()
yaml._save()
data = autoconfig.read()
assert 'window.hide_wayland_decoration' not in data
assert data['window.hide_decoration']['global'] == hide_decoration
def test_bindings_default(self, yaml, autoconfig): def test_bindings_default(self, yaml, autoconfig):
"""Make sure bindings.default gets removed from autoconfig.yml.""" """Make sure bindings.default gets removed from autoconfig.yml."""
autoconfig.write({'bindings.default': {'global': '{}'}}) autoconfig.write({'bindings.default': {'global': '{}'}})