[gnome-shell] [AppSwitcher] Put apps with no window on current workspace at the end.



commit 1c69380923a7bbb5e7580130cefca010671f64c9
Author: Steve Frécinaux <code istique net>
Date:   Tue Sep 29 19:29:17 2009 +0200

    [AppSwitcher] Put apps with no window on current workspace at the end.
    
    Following the idea expressed in bug 590563 by mccann ("Minimized or
    hidden applications should appear at the end of the list"), we should
    also put applications that have no visible window in the active
    workspace at the end of the alt-tab window list, after apps which have
    minimized windows in the active workspace.

 js/ui/altTab.js |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index ec23fda..827ae6f 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -126,6 +126,14 @@ AltTabPopup.prototype = {
         return true;
     },
 
+    _hasWindowsOnWorkspace: function(appIcon, workspace) {
+        for (let i = 0; i < appIcon.windows.length; i++) {
+            if (appIcon.windows[i].get_workspace() == workspace)
+                return true;
+        }
+        return false;
+    },
+
     _hasVisibleWindows : function(appIcon) {
         for (let i = 0; i < appIcon.windows.length; i++) {
             if (appIcon.windows[i].showing_on_its_workspace())
@@ -135,6 +143,22 @@ AltTabPopup.prototype = {
     },
 
     _sortAppIcon : function(appIcon1, appIcon2) {
+        // We intend to sort the application list so applications appear
+        // with this order:
+        //   1. Apps with visible windows on the active workspace;
+        //   2. Apps with minimized windows on the active workspace;
+        //   3. Apps with visible windows on any other workspace;
+        //   4. Other apps.
+
+        let workspace = global.screen.get_active_workspace();
+        let ws1 = this._hasWindowsOnWorkspace(appIcon1, workspace);
+        let ws2 = this._hasWindowsOnWorkspace(appIcon2, workspace);
+
+        if (ws1 && !ws2)
+            return -1;
+        else if (ws2 && !ws1)
+            return 1;
+
         let vis1 = this._hasVisibleWindows(appIcon1);
         let vis2 = this._hasVisibleWindows(appIcon2);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]