[gnome-shell-extensions] AutoMoveWindows: show overview when the last window workspace is closed



commit 9a8704203b8c0e518eedc36dad130fe3afe4bffb
Author: Alessandro Crismani <alessandro crismani gmail com>
Date:   Tue May 31 23:15:43 2011 +0100

    AutoMoveWindows: show overview when the last window workspace is closed
    
    Using the auto move window the overview is not shown when the last
    window on the last workspace is closed, instead the workspace before is
    activated. This differs from the core gnome-shell's behaviour. Fix the
    extension to show the ovreview instead of changing workspace when the
    last window is closed on the last workspace. The fix is basically merged
    from gnome-shell master.
    
    Summarizing, the behaviour is now:
    - The last window is closed on any workspace but the last: do nothing
    - The last window is closed on the last workspace: show the overview
      instead of switching to the "upper" workspace
    
    https://bugzilla.gnome.org/show_bug.cgi?id=651586

 extensions/auto-move-windows/extension.js |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js
index 136f3cd..eb3d70c 100644
--- a/extensions/auto-move-windows/extension.js
+++ b/extensions/auto-move-windows/extension.js
@@ -104,13 +104,14 @@ function main(extensionMeta) {
         }
 
         let activeWorkspaceIndex = global.screen.get_active_workspace_index();
-        let removingCurrentWorkspace = (emptyWorkspaces[activeWorkspaceIndex] &&
-                                        activeWorkspaceIndex < emptyWorkspaces.length - 1);
+        let activeIsLast = activeWorkspaceIndex == global.screen.n_workspaces - 2;
+        let removingTrailWorkspaces = (emptyWorkspaces[activeWorkspaceIndex] &&
+                                        activeIsLast);
         // Don't enter the overview when removing multiple empty workspaces at startup
-        let showOverview  = (removingCurrentWorkspace &&
+        let showOverview  = (removingTrailWorkspaces &&
                              !emptyWorkspaces.every(function(x) { return x; }));
 
-        if (removingCurrentWorkspace) {
+        if (removingTrailWorkspaces) {
             // "Merge" the empty workspace we are removing with the one at the end
             Main.wm.blockAnimations();
         }
@@ -123,11 +124,8 @@ function main(extensionMeta) {
                 break;
         }
 
-        if (removingCurrentWorkspace) {
-	    if (activeWorkspaceIndex > global.screen.n_workspaces - 1)
-                global.screen.get_workspace_by_index(global.screen.n_workspaces - 1).activate(global.get_current_time());
-	    else
-                global.screen.get_workspace_by_index(activeWorkspaceIndex).activate(global.get_current_time());
+        if (removingTrailWorkspaces) {
+            global.screen.get_workspace_by_index(global.screen.n_workspaces - 1).activate(global.get_current_time());
 
             Main.wm.unblockAnimations();
 



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