Sync space settings on workspace changes

If the indices isn't synced a disable/enable cycle will jumple the workspace
names/backgrounds
This commit is contained in:
Ole Jørgen Brønner
2019-07-01 22:03:49 +02:00
parent 15c4b58ca4
commit fcbede7559
+13
View File
@@ -1366,12 +1366,25 @@ class Spaces extends Map {
}
}
let nextUnusedWorkspaceIndex = nWorkspaces;
for (let [workspace, space] of this) {
if (workspaces[space.workspace] !== true) {
debug('workspace removed', space.workspace);
this.removeSpace(space);
// Maps in javascript (and thus Spaces) remember insertion order
// so the workspaces are sorted by index. The relative ordering
// of the removed workspaces will thus be preserved when resurrected.
space.settings.set_int('index', nextUnusedWorkspaceIndex);
nextUnusedWorkspaceIndex++;
}
}
// Ensure the live spaces have correct indices
for (let [workspace, space] of this) {
space.settings.set_int('index', workspace.index());
Meta.prefs_change_workspace_name(workspace.index(), space.name);
}
};
switchWorkspace(wm, fromIndex, toIndex) {