Skip to content

Instantly share code, notes, and snippets.

@Tireg
Created November 8, 2019 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tireg/a29bf78009f2e6ab65b131cbcfe8486a to your computer and use it in GitHub Desktop.
Save Tireg/a29bf78009f2e6ab65b131cbcfe8486a to your computer and use it in GitHub Desktop.
Fix workspace manager cleanup loop with mutter 3.3x (gala)
diff --git a/src/WorkspaceManager.vala b/src/WorkspaceManager.vala
index dd4a09e..e2da277 100644
--- a/src/WorkspaceManager.vala
+++ b/src/WorkspaceManager.vala
@@ -390,8 +390,12 @@ namespace Gala
unowned Meta.Display display = wm.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var last_index = manager.get_n_workspaces () - 1;
+ unowned List<Meta.Workspace> existing_workspaces = null;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
- unowned Meta.Workspace workspace = manager.get_workspace_by_index (i);
+ existing_workspaces.append (manager.get_workspace_by_index (i));
+ }
+
+ foreach (var workspace in workspaces) {
if (Utils.get_n_windows (workspace) < 1
&& workspace.index () != last_index) {
remove_workspace (workspace);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment