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

f3cbb9
From dd7d9565555fcfc9ecc730e421ec2145988ea755 Mon Sep 17 00:00:00 2001
f3cbb9
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
f3cbb9
Date: Tue, 14 Mar 2017 17:04:36 +0100
f3cbb9
Subject: [PATCH] windowMenu: Bring back workspaces submenu for static
f3cbb9
 workspaces
f3cbb9
f3cbb9
When the titlebar context menu was moved to the shell, the submenu for
f3cbb9
moving to a specific workspace was intentionally left out; some people
f3cbb9
are quite attached to it though, so bring it back when static workspaces
f3cbb9
are used.
f3cbb9
---
f3cbb9
 js/ui/windowMenu.js | 18 ++++++++++++++++--
f3cbb9
 1 file changed, 16 insertions(+), 2 deletions(-)
f3cbb9
f3cbb9
diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js
f3cbb9
index 5cd6802e6..6b7f6f7c9 100644
f3cbb9
--- a/js/ui/windowMenu.js
f3cbb9
+++ b/js/ui/windowMenu.js
f3cbb9
@@ -97,8 +97,6 @@ const WindowMenu = new Lang.Class({
f3cbb9
             if (window.is_always_on_all_workspaces())
f3cbb9
                 item.setSensitive(false);
f3cbb9
 
f3cbb9
-            let nWorkspaces = global.screen.n_workspaces;
f3cbb9
-
f3cbb9
             if (!isSticky) {
f3cbb9
                 let workspace = window.get_workspace();
f3cbb9
                 if (workspace != workspace.get_neighbor(Meta.MotionDirection.LEFT)) {
f3cbb9
@@ -121,6 +119,22 @@ const WindowMenu = new Lang.Class({
f3cbb9
                         window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.DOWN));
f3cbb9
                     }));
f3cbb9
                 }
f3cbb9
+
f3cbb9
+                let nWorkspaces = global.screen.n_workspaces;
f3cbb9
+                if (nWorkspaces > 1 && !Meta.prefs_get_dynamic_workspaces()) {
f3cbb9
+                    item = new PopupMenu.PopupSubMenuMenuItem(_("Move to another workspace"));
f3cbb9
+                    this.addMenuItem(item);
f3cbb9
+
f3cbb9
+                    let currentIndex = global.screen.get_active_workspace_index();
f3cbb9
+                    for (let i = 0; i < nWorkspaces; i++) {
f3cbb9
+                        let index = i;
f3cbb9
+                        let name = Meta.prefs_get_workspace_name(i);
f3cbb9
+                        let subitem = item.menu.addAction(name, Lang.bind(this, function() {
f3cbb9
+                            window.change_workspace_by_index(index, false);
f3cbb9
+                        }));
f3cbb9
+                        subitem.setSensitive(currentIndex != i);
f3cbb9
+                    }
f3cbb9
+                }
f3cbb9
             }
f3cbb9
         }
f3cbb9
 
f3cbb9
-- 
f3cbb9
2.12.0
f3cbb9