Skip to content

Commit 496b2a9

Browse files
authored
Merge branch 'main' into leolost/gesture-controller-zoom
2 parents 7d2972e + be515b5 commit 496b2a9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/WorkspaceManager.vala

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,18 @@ public class Gala.WorkspaceManager : Object {
262262
private void cleanup () {
263263
unowned Meta.WorkspaceManager manager = wm.get_display ().get_workspace_manager ();
264264

265-
foreach (var workspace in manager.get_workspaces ()) {
266-
maybe_remove_workspace (workspace, null);
265+
bool remove_last = false;
266+
foreach (var workspace in manager.get_workspaces ().copy ()) {
267+
if (Utils.get_n_windows (workspace, true) != 0) {
268+
remove_last = false;
269+
continue;
270+
}
271+
272+
if (workspace.active) {
273+
remove_last = true;
274+
} else if (workspace.index () != manager.n_workspaces - 1 || remove_last) {
275+
remove_workspace (workspace);
276+
}
267277
}
268278
}
269279
}

0 commit comments

Comments
 (0)