Skip to content

Commit e02d5d9

Browse files
committed
Fix last ws not removed
1 parent 66b745c commit e02d5d9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/WorkspaceManager.vala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,17 @@ 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-
if (!workspace.active && Utils.get_n_windows (workspace, true) == 0 && workspace.index () != manager.n_workspaces - 1) {
267-
queue_remove_workspace (workspace);
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);
268276
}
269277
}
270278
}

0 commit comments

Comments
 (0)