autoWorkspaces: Merge empty workspaces with the always empty one
When closing a workspace due to the last window on that workspace closing, switch to the overview and show the always empty workspace rather then just going to the adjacent workspace. Based on a patch from Adel Gadllah <adel.gadllah@gmail.com>. https://bugzilla.gnome.org/show_bug.cgi?id=642188
This commit is contained in:
parent
76d788a186
commit
e054dd7813
@ -262,12 +262,28 @@ function _checkWorkspaces() {
|
|||||||
emptyWorkspaces.push(false);
|
emptyWorkspaces.push(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
||||||
|
let currentWorkspaceEmpty = emptyWorkspaces[activeWorkspaceIndex];
|
||||||
|
|
||||||
|
if (currentWorkspaceEmpty) {
|
||||||
|
// "Merge" the empty workspace we are removing with the one at the end
|
||||||
|
wm.blockAnimations();
|
||||||
|
}
|
||||||
|
|
||||||
// Delete other empty workspaces; do it from the end to avoid index changes
|
// Delete other empty workspaces; do it from the end to avoid index changes
|
||||||
for (i = emptyWorkspaces.length - 2; i >= 0; i--) {
|
for (i = emptyWorkspaces.length - 2; i >= 0; i--) {
|
||||||
if (emptyWorkspaces[i])
|
if (emptyWorkspaces[i])
|
||||||
global.screen.remove_workspace(_workspaces[i], global.get_current_time());
|
global.screen.remove_workspace(_workspaces[i], global.get_current_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentWorkspaceEmpty) {
|
||||||
|
global.screen.get_workspace_by_index(global.screen.n_workspaces - 1).activate(global.get_current_time());
|
||||||
|
wm.unblockAnimations();
|
||||||
|
|
||||||
|
if (!overview.visible)
|
||||||
|
overview.show();
|
||||||
|
}
|
||||||
|
|
||||||
_checkWorkspacesId = 0;
|
_checkWorkspacesId = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user