[gnome-shell/wip/fmuellner/fix-536: 8/8] workspaceTracker: Don't keep multiple trailing workspaces
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/fix-536: 8/8] workspaceTracker: Don't keep multiple trailing workspaces
- Date: Thu, 13 Sep 2018 11:53:28 +0000 (UTC)
commit 9d6e1a89fcd8911aa6d822b4757b463e13dcd3f3
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Sep 5 15:27:02 2018 +0200
workspaceTracker: Don't keep multiple trailing workspaces
Since we always keep the active workspace until the user switches
to a different one, we may end up with two empty workspaces at
the end. It's not obvious to users why this happens, and there's
indeed no good reason for the behavior - just remove the trailing
workspace in that case.
https://gitlab.gnome.org/GNOME/gnome-shell/issues/536
js/ui/windowManager.js | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 2295e3010..0c6ab1be0 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -278,15 +278,18 @@ var WorkspaceTracker = new Lang.Class({
// If we don't have an empty workspace at the end, add one
if (!emptyWorkspaces[emptyWorkspaces.length -1]) {
workspaceManager.append_new_workspace(false, global.get_current_time());
- emptyWorkspaces.push(false);
+ emptyWorkspaces.push(true);
}
+ let lastIndex = emptyWorkspaces.length - 1;
+ let lastEmptyIndex = emptyWorkspaces.lastIndexOf(false) + 1;
let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();
emptyWorkspaces[activeWorkspaceIndex] = false;
- // Delete other empty workspaces; do it from the end to avoid index changes
- for (i = emptyWorkspaces.length - 2; i >= 0; i--) {
- if (emptyWorkspaces[i])
+ // Delete empty workspaces except for the last one; do it from the end
+ // to avoid index changes
+ for (i = lastIndex; i >= 0; i--) {
+ if (emptyWorkspaces[i] && i != lastEmptyIndex)
workspaceManager.remove_workspace(this._workspaces[i], global.get_current_time());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]