Do not require restart after decoration option change

This commit is contained in:
rien333 2018-03-22 23:26:45 +01:00
parent 764e79e505
commit 2d2bdad2ca
5 changed files with 22 additions and 6 deletions

View File

@ -3157,7 +3157,7 @@ Default:
- +pass:[utm_term]+
- +pass:[utm_content]+
[[window.hide_wayland_decoration]]
[[window.hide_decoration]]
=== window.hide_decoration
Hide the window decoration.
This setting requires a restart.

View File

@ -0,0 +1 @@
rw@domper.local.3624

View File

@ -1536,8 +1536,10 @@ url.yank_ignored_parameters:
window.hide_decoration:
type: Bool
default: false
restart: true
desc: Hide the window decoration.
restart: false
desc: |
Hide the window decoration. Does require a restart for
Wayland users.
window.title_format:
type:

View File

@ -90,6 +90,9 @@ def _init_envvars():
if config.val.qt.force_platform is not None:
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:
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'

View File

@ -169,9 +169,6 @@ class MainWindow(QWidget):
objreg.register('message-bridge', message_bridge, scope='window',
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._vbox = QVBoxLayout(self)
self._vbox.setContentsMargins(0, 0, 0, 0)
@ -233,6 +230,8 @@ class MainWindow(QWidget):
config.instance.changed.connect(self._on_config_changed)
objreg.get("app").new_window.emit(self)
self._set_decoration(config.val.window.hide_decoration)
def _init_geometry(self, geometry):
"""Initialize the window geometry or load it from disk."""
@ -347,6 +346,8 @@ class MainWindow(QWidget):
elif option == 'statusbar.position':
self._add_widgets()
self._update_overlay_geometries()
elif option == 'window.hide_decoration':
self._set_decoration(config.val.window.hide_decoration)
def _add_widgets(self):
"""Add or readd all widgets to the VBox."""
@ -496,6 +497,15 @@ class MainWindow(QWidget):
completion_obj.on_clear_completion_selection)
cmd.hide_completion.connect(completion_obj.hide)
def _set_decoration(self, hidden):
""" Set the visibility of the window decoration via Qt."""
window_flags = Qt.Window
if hidden:
window_flags |= Qt.CustomizeWindowHint | Qt.NoDropShadowWindowHint
self.setWindowFlags(window_flags)
self.hide()
self.show()
@pyqtSlot(bool)
def _on_fullscreen_requested(self, on):
if not config.val.content.windowed_fullscreen: