Skip to content

fix: keep each workspace's windows apart when a workspace is removed - #572

Open
mattchristenson wants to merge 1 commit into
forge-ext:mainfrom
Reliable-Collaboration:fix/workspace-renumber
Open

mattchristenson wants to merge 1 commit into
forge-ext:mainfrom
Reliable-Collaboration:fix/workspace-renumber

Conversation

@mattchristenson

Copy link
Copy Markdown

Fixes #470.

Problem. With dynamic workspaces, closing the last window of a workspace removes that workspace, and GNOME renumbers the ones after it. Forge's tree names its workspace and monitor nodes by index (ws1, mo0ws1, ...). removeWorkspace() dropped the removed node, but it didn't rename the others. So workspace 2 (now index 1) kept its node ws2, while ws1 still held the old workspace 1's windows. The next time a window was placed by its workspace index, it was filed under another workspace's node. Windows of two workspaces then shared one split, each at half width, as reported in #470.

after workspace 1 is removed: the window on the new first workspace is half wide on main, full with the fix

Change. Tree._renumberWorkspaces(fromIndex) renames the workspace nodes after the removed one, and their monitor nodes, down by one; removeWorkspace() calls it. Containers aren't named by index, so they need no change. Inserting a workspace needs nothing: GNOME always adds a workspace at the end and moves the windows after the insertion point up one index, each through its own workspace change, which Forge already follows.

Not in this PR. The workspace-skip-tile setting also lists workspaces by index. After a removal, the numbers in it point at different workspaces. Whether that setting should follow the workspace or the number is a separate question.

Merging note. With #557 (stale tab bars), removeWorkspace() also calls _forgetRemoved(); keep both calls, that one first.

Testing. Scenario scenarios/19_workspace_removed.py:

  • 19.1: one window on each of workspaces 1, 2 and 3; close the one on workspace 1. On main, the two remaining windows are filed under the same workspace node and each is half wide. With this PR, each fills its own workspace.
  • 19.2: the same with two windows on the middle workspace.
  • 19.3: a new window afterwards joins only the windows of its own workspace.

main 0/3 → 3/3. The rest of the suite is unchanged against main. It was also run on a build together with the other open PRs, in the sandbox and in a real GNOME Shell 50 session. prettier@2.7.1 --check is clean.

How to reproduce by hand. Dynamic workspaces on. Put one window on each of workspaces 1, 2 and 3. Close the one on workspace 1. The windows now on workspaces 1 and 2 should each fill their workspace. On main, they are laid out as if they were on the same workspace, each at half width.

🤖 Generated with Claude Code

Workspace and monitor nodes are named by workspace index (ws{n}, mo{m}ws{n}).
When GNOME removes a workspace (dynamic workspaces: its last window closed), it
renumbers the ones after it, but Forge only dropped the removed node. The next
window placed by its workspace index was filed under another workspace's node,
and the windows of two workspaces shared one split (forge-ext#470).

Rename the nodes of the following workspaces down by one on removal.

Fixes forge-ext#470

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Closing All Windows In A Workspace Disrupts Tiling In The Next Two Workspaces

1 participant