Skip to content

fix: after Super+V or Super+Z, the next window opens that way with auto-split on - #578

Open
mattchristenson wants to merge 1 commit into
forge-ext:mainfrom
Reliable-Collaboration:fix/split-direction-kept
Open

mattchristenson wants to merge 1 commit into
forge-ext:mainfrom
Reliable-Collaboration:fix/split-direction-kept

Conversation

@mattchristenson

Copy link
Copy Markdown

Fixes #409.

Problem. Super+V (split vertically) and Super+Z (split horizontally) choose the direction for the next window: the focused window goes into a container with that direction, or, if it is alone on the workspace, the workspace takes that direction. With auto-split on (the default), opening the next window ran the auto-split on the focused window first. That splits it again by its shape (side by side if it is wider than tall), so the direction the user had just chosen was overridden:

  • after Super+V on a lone window of a landscape screen, the new window opened beside it;
  • after Super+Z on a tall window, the new window opened below it.

Super+V on a lone window, then a new window

Change.

  • The Split command, when the user gives it, records the choice for the focused window on the node whose direction it set (splitChosenFor). Auto-split's own Split call is marked auto: true and records nothing.
  • While that window is still the only tiled window there, trackWindow() doesn't auto-split it when a new window opens, so the new window goes the chosen way. Once a window has joined, the choice has done its job. When a tiled window leaves that node, the record is cleared, so a one-time choice doesn't keep overriding auto-split later.
  • A dialog that opens in between floats, so it doesn't count. It isn't identified at creation, when GTK hasn't set its parent yet; it simply isn't tiled.
  • Auto-split now only runs for a window Forge will manage and doesn't have yet, so menus and tooltips no longer set it off. As a side effect, they no longer split the focused window at all; before, they did.

Without a Split command, auto-split works as before.

Merging note. #576 makes the same "only for a new window" change for another reason. Whichever merges second keeps one copy.

Testing. Scenario scenarios/25_split_then_open.py (auto-split on):

  • 25.1: A | B, Super+V on B, open C: C opens below B;
  • 25.2: one window, Super+V, open another: it opens below. It fails on main, where it opens beside;
  • 25.3: A | B (B is tall), Super+Z on B, open C: C opens beside B. It fails on main, where it opens below;
  • 25.4: no split command, so auto-split decides by B's shape as before (a guard);
  • 25.5: one window, Super+V, then the app's menu opens and closes (a popup window), then a new window: it still opens below;
  • 25.6: the same with a dialog (Ctrl+O, the file chooser).

25.5 and 25.6 fail on main: main 2/6 → 6/6 (25.1 passes on main only because B's shape happens to agree). The rest of the suite is unchanged. prettier@2.7.1 --check is clean.

🤖 Generated with Claude Code

…to-split on

Super+V/Super+Z set the direction for the focused window's container (or the
workspace, for a lone window). With auto-split on (the default), opening the
next window split the focused window again by its shape, which overrode that
choice: a landscape window got its new neighbour beside it after Super+V (forge-ext#409).

The Split command, when the user gives it (auto-split's own call is marked),
records the choice for the focused window on the node whose direction it set.
While that window is still the only tiled window there, trackWindow() doesn't
auto-split it for a new window. Auto-split now also only runs for a window
Forge will manage and doesn't have yet, so menus and tooltips don't set it off.

Fixes forge-ext#409

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: split containers not working

1 participant