Blame SOURCES/0001-windowMenu-Bring-back-workspaces-submenu-for-static-.patch

35159f
From 20640a92f98e2145b9b6581209c978e9f6f78801 Mon Sep 17 00:00:00 2001
35159f
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
35159f
Date: Tue, 14 Mar 2017 17:04:36 +0100
35159f
Subject: [PATCH] windowMenu: Bring back workspaces submenu for static
35159f
 workspaces
35159f
35159f
When the titlebar context menu was moved to the shell, the submenu for
35159f
moving to a specific workspace was intentionally left out; some people
35159f
are quite attached to it though, so bring it back when static workspaces
35159f
are used.
35159f
---
35159f
 js/ui/windowMenu.js | 17 +++++++++++++++++
35159f
 1 file changed, 17 insertions(+)
35159f
35159f
diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js
35159f
index 628f145ea..f8eb4398c 100644
35159f
--- a/js/ui/windowMenu.js
35159f
+++ b/js/ui/windowMenu.js
35159f
@@ -115,6 +115,23 @@ var WindowMenu = class extends PopupMenu.PopupMenu {
35159f
                         window.change_workspace(workspace.get_neighbor(dir));
35159f
                     });
35159f
                 }
35159f
+
35159f
+                let { workspaceManager } = global;
35159f
+                let nWorkspaces = workspaceManager.n_workspaces;
35159f
+                if (nWorkspaces > 1 && !Meta.prefs_get_dynamic_workspaces()) {
35159f
+                    item = new PopupMenu.PopupSubMenuMenuItem(_("Move to another workspace"));
35159f
+                    this.addMenuItem(item);
35159f
+
35159f
+                    let currentIndex = workspaceManager.get_active_workspace_index();
35159f
+                    for (let i = 0; i < nWorkspaces; i++) {
35159f
+                        let index = i;
35159f
+                        let name = Meta.prefs_get_workspace_name(i);
35159f
+                        let subitem = item.menu.addAction(name, () => {
35159f
+                            window.change_workspace_by_index(index, false);
35159f
+                        });
35159f
+                        subitem.setSensitive(currentIndex != i);
35159f
+                    }
35159f
+                }
35159f
             }
35159f
         }
35159f
 
35159f
-- 
35159f
2.21.0
35159f