diff --git a/Settings.ui b/Settings.ui index 9881dcc..b224c13 100644 --- a/Settings.ui +++ b/Settings.ui @@ -1,5 +1,5 @@ - + @@ -1775,11 +1775,23 @@ 10 25 + + 50 + 500 + 10 + 50 + 9999 25 100 + + 50 + 500 + 10 + 50 + True False @@ -2096,6 +2108,98 @@ + + + 100 + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + True + 4 + 0 + preview_width_adjustment + True + + + 1 + 0 + + + + + True + False + True + Width of the window previews + True + 0 + + + 0 + 0 + + + + + + + + + 100 + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + True + 4 + 0 + preview_height_adjustment + True + + + 1 + 0 + + + + + True + False + True + Height of the window previews + True + 0 + + + 0 + 0 + + + + + + diff --git a/prefs.js b/prefs.js index 63b0009..18f0c55 100644 --- a/prefs.js +++ b/prefs.js @@ -700,6 +700,16 @@ 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').connect('value-changed', Lang.bind (this, function(widget) { + this._settings.set_int('window-previews-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').connect('value-changed', Lang.bind (this, function(widget) { + this._settings.set_int('window-previews-height', widget.get_value()); + })); + dialog.connect('response', Lang.bind(this, function(dialog, id) { if (id == 1) { // restore default settings @@ -711,6 +721,13 @@ const Settings = new Lang.Class({ 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')); 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-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('preview-middle-click-close', this._settings.get_default_value('preview-middle-click-close')); } else { 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 0793571..278a3bb 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,16 @@ Enable peek mode Peek a window upon hover for some time + + 350 + Window previews width + The width of the window previews + + + 200 + Window previews height + The height of the window previews + false Provide workspace isolation diff --git a/windowPreview.js b/windowPreview.js index ef39ce2..4a6f292 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -44,9 +44,6 @@ const Taskbar = Me.imports.taskbar; const Convenience = Me.imports.convenience; const AppIcons = Me.imports.appIcons; -let DEFAULT_THUMBNAIL_WIDTH = 350; -let DEFAULT_THUMBNAIL_HEIGHT = 200; - let HOVER_APP_BLACKLIST = [ "Oracle VM VirtualBox", "Virtual Machine Manager", @@ -507,15 +504,16 @@ var thumbnailPreview = new Lang.Class({ Name: 'DashToPanel.ThumbnailPreview', Extends: PopupMenu.PopupBaseMenuItem, - _init: function(window) { + _init: function(window, settings) { + this._dtpSettings = settings; this.window = window; let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; if(!scaleFactor) scaleFactor = 1; - this._thumbnailWidth = DEFAULT_THUMBNAIL_WIDTH*scaleFactor; - this._thumbnailHeight = DEFAULT_THUMBNAIL_HEIGHT*scaleFactor; + this._thumbnailWidth = this._dtpSettings.get_int('window-previews-width')*scaleFactor; + this._thumbnailHeight = this._dtpSettings.get_int('window-previews-height')*scaleFactor; this.parent({reactive: true}); this._workId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._onResize)); @@ -816,7 +814,7 @@ var thumbnailPreview = new Lang.Class({ break; case 2: // Middle click - if (this._getTopMenu()._dtpSettings.get_boolean('preview-middle-click-close')) { + if (this._dtpSettings.get_boolean('preview-middle-click-close')) { this._closeWindow(); } break; @@ -892,6 +890,9 @@ var thumbnailPreviewList = new Lang.Class({ this._scrollbarId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._showHideScrollbar)); 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._stateChangedId = this.window ? 0 : this.app.connect('windows-changed', Lang.bind(this, this._queueRedisplay)); @@ -989,8 +990,7 @@ var thumbnailPreviewList = new Lang.Class({ }, _createPreviewItem: function(window) { - let preview = new thumbnailPreview(window); - + let preview = new thumbnailPreview(window, this._dtpSettings); preview.actor.connect('notify::hover', Lang.bind(this, function() { if (preview.actor.hover){ @@ -1016,14 +1016,31 @@ var thumbnailPreviewList = new Lang.Class({ return preview; }, + _resetPreviews: function() { + let previews = this._getPreviews(); + let l = previews.length; + + if (l > 0) { + for (let i = 0; i < l; ++i) { + previews[i]._delegate.animateOutAndDestroy(); + } + + this._queueRedisplay(); + } + }, + + _getPreviews: function() { + return this.box.get_children().filter(function(actor) { + return actor._delegate.window && + actor._delegate.preview && + !actor._delegate.animatingOut; + }); + }, + _redisplay: function () { let windows = this.window ? [this.window] : AppIcons.getInterestingWindows(this.app, this._dtpSettings).sort(this.sortWindowsCompareFunction); - let children = this.box.get_children().filter(function(actor) { - return actor._delegate.window && - actor._delegate.preview && - !actor._delegate.animatingOut; - }); + let children = this._getPreviews(); // Apps currently in the taskbar let oldWin = children.map(function(actor) { return actor._delegate.window;