Skip to content

Instantly share code, notes, and snippets.

@Tireg
Created November 8, 2019 13:42
Show Gist options
  • Save Tireg/e441b9c53c022b2b8a966bf1626a38d8 to your computer and use it in GitHub Desktop.
Save Tireg/e441b9c53c022b2b8a966bf1626a38d8 to your computer and use it in GitHub Desktop.
Fix workspace manager cleanup with mutter 3.3x
diff --git a/src/WorkspaceManager.vala b/src/WorkspaceManager.vala
index dd4a09e..c49fe4c 100644
--- a/src/WorkspaceManager.vala
+++ b/src/WorkspaceManager.vala
@@ -389,9 +389,13 @@ namespace Gala
#if HAS_MUTTER330
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) {
+ var last_index = manager.get_n_workspaces () - 1;
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