From 1694632c68c13e62e5d401057788706796134a3a Mon Sep 17 00:00:00 2001 From: zeitigeist Date: Fri, 4 Jan 2019 16:27:36 +0300 Subject: [PATCH] Added new option to clicking on the icon of a running application If running application has more than 1 window don't close the window preview and do nothing. If running application has 1 window minimize or activate. This behaviour is more similar to Windows. --- Settings.ui | 1 + appIcons.js | 22 +++++++++++++++---- ...shell.extensions.dash-to-panel.gschema.xml | 1 + 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Settings.ui b/Settings.ui index 811a165..1ae4412 100644 --- a/Settings.ui +++ b/Settings.ui @@ -5428,6 +5428,7 @@ Launch new instance Cycle through windows Cycle windows + minimize + Do nothing + minimize diff --git a/appIcons.js b/appIcons.js index 8b78c9a..bf8390f 100644 --- a/appIcons.js +++ b/appIcons.js @@ -717,9 +717,6 @@ var taskbarAppIcon = new Lang.Class({ }, activate: function(button, handleAsGrouped) { - if (this.windowPreview) - this.windowPreview.requestCloseMenu(); - let event = Clutter.get_current_event(); let modifiers = event ? event.get_state() : 0; let focusedApp = tracker.focus_app; @@ -753,7 +750,11 @@ var taskbarAppIcon = new Lang.Class({ else buttonAction = this._dtpSettings.get_string('click-action'); } - + + let appCount = this.getAppIconInterestingWindows().length; + if (this.windowPreview && (!(buttonAction == "NOTHING-MIN") || (appCount <= 1))) + this.windowPreview.requestCloseMenu(); + // We check if the app is running, and that the # of windows is > 0 in // case we use workspace isolation, let appIsRunning = this.app.state == Shell.AppState.RUNNING @@ -839,6 +840,19 @@ var taskbarAppIcon = new Lang.Class({ else this.app.activate(); break; + case "NOTHING-MIN": + if (appCount == 1) { + if (!Main.overview._shown) { + if (this.app == focusedApp) + cycleThroughWindows(this.app, this._dtpSettings, false, true); + else { + activateFirstWindow(this.app, this._dtpSettings); + } + } + else + this.app.activate(); + } + break; case "QUIT": closeAllWindows(this.app, this._dtpSettings); 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 5be9cda..1aa8bf4 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -16,6 +16,7 @@ +