From 609a298baa2ac2c16e8eb0b59d37229313de6f75 Mon Sep 17 00:00:00 2001 From: CharlesG Date: Thu, 5 Apr 2018 23:03:50 -0500 Subject: [PATCH] Add setting to hide the window title in previews --- Settings.ui | 44 +++++++++++++++++++ prefs.js | 5 +++ ...shell.extensions.dash-to-panel.gschema.xml | 5 +++ windowPreview.js | 40 ++++++++++------- 4 files changed, 78 insertions(+), 16 deletions(-) diff --git a/Settings.ui b/Settings.ui index b224c13..ca69118 100644 --- a/Settings.ui +++ b/Settings.ui @@ -2108,6 +2108,50 @@ + + + 100 + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + False + True + Display window title in previews + True + 0 + + + 0 + 0 + + + + + True + True + end + center + + + 1 + 0 + + + + + + 100 diff --git a/prefs.js b/prefs.js index 18f0c55..4bbbb29 100644 --- a/prefs.js +++ b/prefs.js @@ -675,6 +675,10 @@ const Settings = new Lang.Class({ this._builder.get_object('peek_mode_switch'), 'active', Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('window-preview-show-title', + this._builder.get_object('preview_show_title_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); this._settings.bind('peek-mode', this._builder.get_object('listboxrow_enter_peek_mode_timeout'), 'sensitive', @@ -717,6 +721,7 @@ const Settings = new Lang.Class({ this._builder.get_object('preview_timeout_spinbutton').set_value(this._settings.get_int('show-window-previews-timeout')); this._settings.set_value('peek-mode', this._settings.get_default_value('peek-mode')); + this._settings.set_value('window-preview-show-title', this._settings.get_default_value('window-preview-show-title')); this._settings.set_value('enter-peek-mode-timeout', this._settings.get_default_value('enter-peek-mode-timeout')); this._builder.get_object('enter_peek_mode_timeout_spinbutton').set_value(this._settings.get_int('enter-peek-mode-timeout')); this._settings.set_value('peek-mode-opacity', this._settings.get_default_value('peek-mode-opacity')); diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml index 278a3bb..339c7f0 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -257,6 +257,11 @@ Enable peek mode Peek a window upon hover for some time + + true + Display title in preview + Display window title in preview + 350 Window previews width diff --git a/windowPreview.js b/windowPreview.js index 4a6f292..7c9549d 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -543,28 +543,35 @@ var thumbnailPreview = new Lang.Class({ this.overlayGroup.add_actor(this._previewBin); this.overlayGroup.add_actor(this._closeButton); - this._title = new St.Label({ text: window.title }); - this._titleBin = new St.Bin({ child: this._title, - x_align: St.Align.MIDDLE, - width: this._thumbnailWidth - }); - this._titleBin.add_style_class_name("preview-window-title"); + this._titleNotifyId = 0; - this._titleNotifyId = this.window.connect('notify::title', Lang.bind(this, function() { - this._title.set_text(this.window.title); - })); - - this._windowBin = new St.Bin({ child: this.overlayGroup, - x_align: St.Align.MIDDLE, - width: this._thumbnailWidth, - height: this._thumbnailHeight - }); + this._windowBin = new St.Bin({ + child: this.overlayGroup, + x_align: St.Align.MIDDLE, + width: this._thumbnailWidth, + height: this._thumbnailHeight + }); this._windowBox.add_child(this._windowBin); + if (this._dtpSettings.get_boolean('window-preview-show-title')) { + this._title = new St.Label({ text: window.title }); + this._titleBin = new St.Bin({ child: this._title, + x_align: St.Align.MIDDLE, + width: this._thumbnailWidth + }); + this._titleBin.add_style_class_name("preview-window-title"); + + this._windowBox.add_child(this._titleBin); + + this._titleNotifyId = this.window.connect('notify::title', Lang.bind(this, function() { + this._title.set_text(this.window.title); + })); + } + if (this.preview) this._previewBin.set_child(this.preview); - this._windowBox.add_child(this._titleBin); + this.actor.add_child(this._windowBox); this._queueRepositionCloseButton(); @@ -893,6 +900,7 @@ var thumbnailPreviewList = new Lang.Class({ this._dtpSettings.connect('changed::window-previews-width', () => this._resetPreviews()); this._dtpSettings.connect('changed::window-previews-height', () => this._resetPreviews()); + this._dtpSettings.connect('changed::window-preview-show-title', () => this._resetPreviews()); this._stateChangedId = this.window ? 0 : this.app.connect('windows-changed', Lang.bind(this, this._queueRedisplay));