Skip to content

Add a repeated-commands option that switches to the opposite side - #1925

Open
AkiyamaKunka wants to merge 1 commit into
rxhanson:mainfrom
AkiyamaKunka:feat/cycle-sides-repeat
Open

AkiyamaKunka wants to merge 1 commit into
rxhanson:mainfrom
AkiyamaKunka:feat/cycle-sides-repeat

Conversation

@AkiyamaKunka

Copy link
Copy Markdown
Contributor

Closes #1761.

Adds "Switch to the opposite side on half actions" to the Repeated commands setting (subsequentExecutionMode 6, off by default). Repeating Left Half while the window still sits on the left half moves it to the right half and the next repeat brings it back; the same for Right, Top and Bottom. The calculation reports the opposite half as the resulting action, so the next press is no longer a repeat and falls back to a plain half. A first execution, a window that moved since, or an unrelated last action get a plain half; thirds, fourths and the grid actions keep their existing repeat behaviour, and the option neither resizes nor traverses displays.

Given the WindowManager refactor mentioned on #1913, the logic lives in the half calculations (plus a shared isRepeatedCommand overload for RectCalculationParameters). The only change on the WindowManager side is a guard in cooperativeCornerResizePlan: in this mode a repeated half action that moved both of its edges is a move, not a resize of the shared edge, which would otherwise squeeze the neighbour and record a wrong split ratio.

One semantic note: the behaviour is state-based, so pressing Right Half on a window that reached the right half through a flipped Left Half counts as a repeat and flips it back.

Also documents values 5 and 6 in TerminalCommands.md and adds the zh-Hans string. Tests cover both axes, the complementary split ratio at 60%, the interplay with "halves preserve the other axis", the cooperative-resize guard, and that no other mode switches sides. 600 tests pass on macOS 27.0.1 / Xcode 27.

🤖 Generated with Claude Code

Repeating Left Half while the window still sits on the left half now
moves it to the right half, and the next repeat brings it back; the same
for Right, Top and Bottom. The new "Switch to the opposite side on half
actions" entry in the Repeated commands setting (subsequentExecutionMode
6) is off by default, so existing behaviour is unchanged.

The toggle works through the action history: the calculation reports the
opposite half as its resulting action, so the next press of the same
shortcut is no longer a repeat and falls back to the plain half. A first
execution, a window that moved since the last action, or an unrelated
last action get a plain half. Thirds, fourths and the grid actions keep
their existing repeat behaviour in this mode, and the option neither
resizes nor traverses displays.

Leaves WindowManager.swift and the execute path untouched: the logic
lives in the half calculations, with a shared isRepeatedCommand overload
for RectCalculationParameters. The only change on the WindowManager side
is a guard in cooperativeCornerResizePlan so that, in this mode, a
repeated half action that moved both of its edges (a side switch) is
treated as a move rather than as a resize of the shared edge, which would
otherwise squeeze the neighbour and record a wrong split ratio.

Documents the value in TerminalCommands.md (and the undocumented value 5)
and adds the zh-Hans string. Tests cover both axes, the complementary
split ratio at 60%, the interplay with "halves preserve the other axis",
the cooperative-resize guard, and that no other mode switches sides.

Closes rxhanson#1761

Co-Authored-By: Claude Fable 5.1 <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.

Add "cycle sides" repeat behavior for left/right half (parity with first-two-thirds)

1 participant