From 2d2bdad2ca1e08ee16f16862a3ce11556bc46181 Mon Sep 17 00:00:00 2001 From: rien333 Date: Thu, 22 Mar 2018 23:26:45 +0100 Subject: [PATCH] Do not require restart after decoration option change --- doc/help/settings.asciidoc | 2 +- qutebrowser/config/.#configfiles.py | 1 + qutebrowser/config/configdata.yml | 6 ++++-- qutebrowser/config/configinit.py | 3 +++ qutebrowser/mainwindow/mainwindow.py | 16 +++++++++++++--- 5 files changed, 22 insertions(+), 6 deletions(-) create mode 120000 qutebrowser/config/.#configfiles.py diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index d81619743..dbee21b8f 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -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. diff --git a/qutebrowser/config/.#configfiles.py b/qutebrowser/config/.#configfiles.py new file mode 120000 index 000000000..3c80a2a2a --- /dev/null +++ b/qutebrowser/config/.#configfiles.py @@ -0,0 +1 @@ +rw@domper.local.3624 \ No newline at end of file diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index f41044d35..0122bbb0d 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -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: diff --git a/qutebrowser/config/configinit.py b/qutebrowser/config/configinit.py index 7f40a74fb..5c06a4a3d 100644 --- a/qutebrowser/config/configinit.py +++ b/qutebrowser/config/configinit.py @@ -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' diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index dfb2f416b..796c1f1b9 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -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: