From d1bdb4eeda3c19a3b50b619f67f2cb21a48b5d99 Mon Sep 17 00:00:00 2001 From: CharlesG Date: Sun, 8 Apr 2018 08:12:52 -0500 Subject: [PATCH] Add settings for window preview padding --- Settings.ui | 56 ++++++++++++++++++- prefs.js | 24 +++++--- ...shell.extensions.dash-to-panel.gschema.xml | 9 ++- stylesheet.css | 2 +- windowPreview.js | 13 +++-- 5 files changed, 86 insertions(+), 18 deletions(-) diff --git a/Settings.ui b/Settings.ui index ca69118..5401bfa 100644 --- a/Settings.ui +++ b/Settings.ui @@ -1781,6 +1781,11 @@ 10 50 + + 50 + 1 + 5 + 9999 25 @@ -2185,7 +2190,7 @@ True False True - Width of the window previews + Width of the window previews (px) True 0 @@ -2231,7 +2236,54 @@ True False True - Height of the window previews + Height of the window previews (px) + True + 0 + + + 0 + 0 + + + + + + + + + 100 + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + True + 4 + 50 + preview_padding_adjustment + True + 50 + + + 1 + 0 + + + + + True + False + True + Padding of the window previews (px) True 0 diff --git a/prefs.js b/prefs.js index 4bbbb29..050f92e 100644 --- a/prefs.js +++ b/prefs.js @@ -704,14 +704,19 @@ const Settings = new Lang.Class({ this._settings.set_int('peek-mode-opacity', widget.get_value()); })); - this._builder.get_object('preview_width_spinbutton').set_value(this._settings.get_int('window-previews-width')); + this._builder.get_object('preview_width_spinbutton').set_value(this._settings.get_int('window-preview-width')); this._builder.get_object('preview_width_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { - this._settings.set_int('window-previews-width', widget.get_value()); + this._settings.set_int('window-preview-width', widget.get_value()); })); - this._builder.get_object('preview_height_spinbutton').set_value(this._settings.get_int('window-previews-height')); + this._builder.get_object('preview_height_spinbutton').set_value(this._settings.get_int('window-preview-height')); this._builder.get_object('preview_height_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { - this._settings.set_int('window-previews-height', widget.get_value()); + this._settings.set_int('window-preview-height', widget.get_value()); + })); + + this._builder.get_object('preview_padding_spinbutton').set_value(this._settings.get_int('window-preview-padding')); + this._builder.get_object('preview_padding_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._settings.set_int('window-preview-padding', widget.get_value()); })); dialog.connect('response', Lang.bind(this, function(dialog, id) { @@ -727,11 +732,14 @@ const Settings = new Lang.Class({ this._settings.set_value('peek-mode-opacity', this._settings.get_default_value('peek-mode-opacity')); this._builder.get_object('peek_mode_opacity_spinbutton').set_value(this._settings.get_int('peek-mode-opacity')); - this._settings.set_value('window-previews-width', this._settings.get_default_value('window-previews-width')); - this._builder.get_object('preview_width_spinbutton').set_value(this._settings.get_int('window-previews-width')); + this._settings.set_value('window-preview-width', this._settings.get_default_value('window-preview-width')); + this._builder.get_object('preview_width_spinbutton').set_value(this._settings.get_int('window-preview-width')); - this._settings.set_value('window-previews-height', this._settings.get_default_value('window-previews-height')); - this._builder.get_object('preview_height_spinbutton').set_value(this._settings.get_int('window-previews-height')); + this._settings.set_value('window-preview-height', this._settings.get_default_value('window-preview-height')); + this._builder.get_object('preview_height_spinbutton').set_value(this._settings.get_int('window-preview-height')); + + this._settings.set_value('window-preview-padding', this._settings.get_default_value('window-preview-padding')); + this._builder.get_object('preview_padding_spinbutton').set_value(this._settings.get_int('window-preview-padding')); this._settings.set_value('preview-middle-click-close', this._settings.get_default_value('preview-middle-click-close')); 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 339c7f0..ded9478 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -262,16 +262,21 @@ Display title in preview Display window title in preview - + 350 Window previews width The width of the window previews - + 200 Window previews height The height of the window previews + + 20 + Window previews padding + The padding of the window previews + false Provide workspace isolation diff --git a/stylesheet.css b/stylesheet.css index a8af2da..762ec06 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -65,7 +65,7 @@ } #dashtopanelThumbnailList .popup-menu-item { - padding: 1em; + padding: 0; border-radius: 5px; spacing: 0; } diff --git a/windowPreview.js b/windowPreview.js index 7c9549d..81f1914 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -512,8 +512,8 @@ var thumbnailPreview = new Lang.Class({ if(!scaleFactor) scaleFactor = 1; - this._thumbnailWidth = this._dtpSettings.get_int('window-previews-width')*scaleFactor; - this._thumbnailHeight = this._dtpSettings.get_int('window-previews-height')*scaleFactor; + this._thumbnailWidth = this._dtpSettings.get_int('window-preview-width')*scaleFactor; + this._thumbnailHeight = this._dtpSettings.get_int('window-preview-height')*scaleFactor; this.parent({reactive: true}); this._workId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._onResize)); @@ -525,6 +525,8 @@ var thumbnailPreview = new Lang.Class({ this.actor.remove_child(this._ornamentLabel); this.actor._delegate = this; + this.actor.set_style('padding: ' + this._dtpSettings.get_int('window-preview-padding') + 'px;'); + this.animatingOut = false; this._windowBox = new St.BoxLayout({ style_class: 'window-box', @@ -898,10 +900,11 @@ var thumbnailPreviewList = new Lang.Class({ this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); - this._dtpSettings.connect('changed::window-previews-width', () => this._resetPreviews()); - this._dtpSettings.connect('changed::window-previews-height', () => this._resetPreviews()); + this._dtpSettings.connect('changed::window-preview-width', () => this._resetPreviews()); + this._dtpSettings.connect('changed::window-preview-height', () => this._resetPreviews()); this._dtpSettings.connect('changed::window-preview-show-title', () => this._resetPreviews()); - + this._dtpSettings.connect('changed::window-preview-padding', () => this._resetPreviews()); + this._stateChangedId = this.window ? 0 : this.app.connect('windows-changed', Lang.bind(this, this._queueRedisplay)); },