diff --git a/Settings.ui b/Settings.ui index a4d3591..78f33bd 100644 --- a/Settings.ui +++ b/Settings.ui @@ -967,7 +967,6 @@ 100 - 0 1000 10 100 @@ -1279,6 +1278,12 @@ 25 100 + + 1 + 40 + 1 + 10 + True False @@ -1995,6 +2000,60 @@ + + True + False + vertical + + + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + False + True + Show Desktop button width (px) + 0 + + + 0 + 0 + + + + + True + True + 4 + 0 + show_showdesktop_width_adjustment + True + + + 1 + 0 + + + + + + + False + True + 0 + + + 0.33000000000000002 1 @@ -2826,18 +2885,6 @@ 12 12 32 - - - True - True - end - center - - - 1 - 0 - - True @@ -2852,6 +2899,55 @@ 0 + + + True + False + 6 + + + True + True + True + center + center + 0.46000000834465027 + + + True + False + emblem-system-symbolic + + + + + + False + True + 0 + + + + + True + True + end + center + + + False + True + 1 + + + + + 1 + 0 + + diff --git a/panel.js b/panel.js index 099fb9b..8df8f9f 100644 --- a/panel.js +++ b/panel.js @@ -328,6 +328,8 @@ var dtpPanel = new Lang.Class({ this._dtpSettings.connect('changed::show-showdesktop-button', Lang.bind(this, function() { this._displayShowDesktopButton(this._dtpSettings.get_boolean('show-showdesktop-button')); })); + + this._dtpSettings.connect('changed::showdesktop-button-width', () => this._setShowDesktopButtonWidth()); }, _allocate: function(actor, box, flags) { @@ -531,6 +533,8 @@ var dtpPanel = new Lang.Class({ y_fill: true, track_hover: true }); + this._setShowDesktopButtonWidth(); + this._showDesktopButton.connect('button-press-event', Lang.bind(this, this._onShowDesktopButtonPress)); this._showDesktopButton.connect('enter-event', Lang.bind(this, function(){ @@ -552,6 +556,12 @@ var dtpPanel = new Lang.Class({ } }, + _setShowDesktopButtonWidth: function() { + if (this._showDesktopButton) { + this._showDesktopButton.set_style('width: ' + this._dtpSettings.get_int('showdesktop-button-width') + 'px;'); + } + }, + _onShowDesktopButtonPress: function() { if(this._focusAppChangeId){ tracker.disconnect(this._focusAppChangeId); diff --git a/prefs.js b/prefs.js index d620757..fdbd9fe 100644 --- a/prefs.js +++ b/prefs.js @@ -430,6 +430,46 @@ const Settings = new Lang.Class({ this._builder.get_object('show_showdesktop_button_switch'), 'active', Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('show-showdesktop-button', + this._builder.get_object('show_showdesktop_options_button'), + 'sensitive', + Gio.SettingsBindFlags.DEFAULT); + + this._builder.get_object('show_showdesktop_options_button').connect('clicked', Lang.bind(this, function() { + + let dialog = new Gtk.Dialog({ title: _('Show Desktop options'), + transient_for: this.widget.get_toplevel(), + use_header_bar: true, + modal: true }); + + // GTK+ leaves positive values for application-defined response ids. + // Use +1 for the reset action + dialog.add_button(_('Reset to defaults'), 1); + + let box = this._builder.get_object('show_showdesktop_options'); + dialog.get_content_area().add(box); + + this._builder.get_object('show_showdesktop_width_spinbutton').set_value(this._settings.get_int('showdesktop-button-width')); + this._builder.get_object('show_showdesktop_width_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._settings.set_int('showdesktop-button-width', widget.get_value()); + })); + + dialog.connect('response', Lang.bind(this, function(dialog, id) { + if (id == 1) { + // restore default settings + this._settings.set_value('showdesktop-button-width', this._settings.get_default_value('showdesktop-button-width')); + this._builder.get_object('show_showdesktop_width_spinbutton').set_value(this._settings.get_int('showdesktop-button-width')); + } else { + // remove the settings box so it doesn't get destroyed; + dialog.get_content_area().remove(box); + dialog.destroy(); + } + return; + })); + + dialog.show_all(); + })); + this._settings.bind('show-appmenu', this._builder.get_object('show_appmenu_switch'), 'active', 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 30c044f..40e39ad 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -172,6 +172,11 @@ Show desktop button Show button on right side of bar that minimizes/restores all visible windows on current workspace + + 4 + Width of show Desktop button + Customize the width of the show Desktop button + false Show appMenu button