diff --git a/Settings.ui b/Settings.ui
index 9690589..08a44fa 100644
--- a/Settings.ui
+++ b/Settings.ui
@@ -575,6 +575,182 @@
+
10
1
@@ -3139,66 +3315,22 @@
+
+ 5000
+ 10
+ 100
+
+
+ 5000
+ 10
+ 100
+
1
40
1
10
-
- 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
diff --git a/panel.js b/panel.js
index 4faff25..1046273 100644
--- a/panel.js
+++ b/panel.js
@@ -50,6 +50,7 @@ const PopupMenu = imports.ui.popupMenu;
const IconGrid = imports.ui.iconGrid;
const ViewSelector = imports.ui.viewSelector;
const DateMenu = imports.ui.dateMenu;
+const Tweener = imports.ui.tweener;
const Intellihide = Me.imports.intellihide;
const Transparency = Me.imports.transparency;
@@ -273,6 +274,11 @@ var dtpPanelWrapper = new Lang.Class({
this.intellihide.destroy();
}
+ if (this._showDesktopTimeoutId) {
+ Mainloop.source_remove(this._showDesktopTimeoutId);
+ this._showDesktopTimeoutId = 0;
+ }
+
this.dynamicTransparency.destroy();
// reset stored icon size to the default dash
@@ -606,10 +612,27 @@ var dtpPanelWrapper = new Lang.Class({
this._showDesktopButton.connect('enter-event', Lang.bind(this, function(){
this._showDesktopButton.add_style_class_name('showdesktop-button-hovered');
+
+ if (this._dtpSettings.get_boolean('show-showdesktop-hover')) {
+ this._showDesktopTimeoutId = Mainloop.timeout_add(this._dtpSettings.get_int('show-showdesktop-delay'), () => {
+ this._hiddenDesktopWorkspace = Utils.DisplayWrapper.getWorkspaceManager().get_active_workspace();
+ this._toggleWorkspaceWindows(true, this._hiddenDesktopWorkspace);
+ this._showDesktopTimeoutId = 0;
+ });
+ }
}));
this._showDesktopButton.connect('leave-event', Lang.bind(this, function(){
this._showDesktopButton.remove_style_class_name('showdesktop-button-hovered');
+
+ if (this._dtpSettings.get_boolean('show-showdesktop-hover')) {
+ if (this._showDesktopTimeoutId) {
+ Mainloop.source_remove(this._showDesktopTimeoutId);
+ this._showDesktopTimeoutId = 0;
+ } else {
+ this._toggleWorkspaceWindows(false, this._hiddenDesktopWorkspace);
+ }
+ }
}));
this.panel._rightBox.insert_child_at_index(this._showDesktopButton, this.panel._rightBox.get_children().length);
@@ -629,6 +652,16 @@ var dtpPanelWrapper = new Lang.Class({
}
},
+ _toggleWorkspaceWindows: function(hide, workspace) {
+ workspace.list_windows().forEach(w =>
+ Tweener.addTween(w.get_compositor_private(), {
+ opacity: hide ? 0 : 255,
+ time: this._dtpSettings.get_int('show-showdesktop-time') * .001,
+ transition: 'easeOutQuad'
+ })
+ );
+ },
+
_onShowDesktopButtonPress: function() {
if(this._focusAppChangeId){
tracker.disconnect(this._focusAppChangeId);
@@ -636,6 +669,11 @@ var dtpPanelWrapper = new Lang.Class({
}
if(this._restoreWindowList && this._restoreWindowList.length) {
+ if (this._showDesktopTimeoutId) {
+ Mainloop.source_remove(this._showDesktopTimeoutId);
+ this._showDesktopTimeoutId = 0;
+ }
+
let current_workspace = Utils.DisplayWrapper.getWorkspaceManager().get_active_workspace();
let windows = current_workspace.list_windows();
this._restoreWindowList.forEach(function(w) {
@@ -643,8 +681,6 @@ var dtpPanelWrapper = new Lang.Class({
Main.activateWindow(w);
});
this._restoreWindowList = null;
-
- Main.overview.hide();
} else {
let current_workspace = Utils.DisplayWrapper.getWorkspaceManager().get_active_workspace();
let windows = current_workspace.list_windows().filter(function (w) {
@@ -663,9 +699,9 @@ var dtpPanelWrapper = new Lang.Class({
this._restoreWindowList = null;
}));
}));
-
- Main.overview.hide();
}
+
+ Main.overview.hide();
},
});
diff --git a/prefs.js b/prefs.js
index a1644c4..ccd2dbc 100644
--- a/prefs.js
+++ b/prefs.js
@@ -879,6 +879,16 @@ const Settings = new Lang.Class({
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
+ this._settings.bind('show-showdesktop-hover',
+ this._builder.get_object('show_showdesktop_hide_switch'),
+ 'active',
+ Gio.SettingsBindFlags.DEFAULT);
+
+ this._settings.bind('show-showdesktop-hover',
+ this._builder.get_object('grid_show_showdesktop_hide_options'),
+ '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'),
@@ -898,11 +908,23 @@ const Settings = new Lang.Class({
this._settings.set_int('showdesktop-button-width', widget.get_value());
}));
+ this._builder.get_object('show_showdesktop_delay_spinbutton').set_value(this._settings.get_int('show-showdesktop-delay'));
+ this._builder.get_object('show_showdesktop_delay_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
+ this._settings.set_int('show-showdesktop-delay', widget.get_value());
+ }));
+
+ this._builder.get_object('show_showdesktop_time_spinbutton').set_value(this._settings.get_int('show-showdesktop-time'));
+ this._builder.get_object('show_showdesktop_time_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
+ this._settings.set_int('show-showdesktop-time', 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'));
+ this._builder.get_object('show_showdesktop_delay_spinbutton').set_value(this._settings.get_int('show-showdesktop-delay'));
+ this._builder.get_object('show_showdesktop_time_spinbutton').set_value(this._settings.get_int('show-showdesktop-time'));
} else {
// remove the settings box so it doesn't get destroyed;
dialog.get_content_area().remove(box);
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 97d2fef..2de408e 100644
--- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
+++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
@@ -350,6 +350,21 @@
Width of show Desktop button
Customize the width of the show Desktop button
+
+ false
+ Show desktop on hover
+ Show the desktop on mouse hover
+
+
+ 1000
+ Delay show desktop
+ Delay before showing the desktop
+
+
+ 300
+ Show desktop animation time
+ Window fade animation time when showing the destop
+
false
Show appMenu button