Repository navigation
Add shortcuts to cycle through stacked windows - #1883
Conversation
|
Thanks for contributing! This makes sense to me, and I'll test/review it soon.
This will likely result in a bug filed due to confusion about the discrepancy. My first thought for resolving it is providing the option for both the hover list & cycle shortcuts to operate on either the same size or any size to keep them in sync. Resolving this isn't necessarily a requirement, but it would improve the concept in my opinion. The stacked windows implementation was worked on by @MyronKoch (feel free to chime in if you have any thoughts/comments). As for that test, I broke it, thanks for the heads up. |
Windows snapped to the same area sit on top of each other, and the hover list is the only way to reach the covered ones. Add two actions, Cycle Stacked Windows and Cycle Stacked Windows Backward, that bring the focused window's stack forward one window at a time. Their shortcuts are set under Behavior > Stacked Windows, next to the hover list's. Stacks are found with the hover list's cascade rule. A new "Only stack windows of the same size" setting, off by default so the hover list behaves as before, limits both the hover list and the cycle shortcuts to windows of one size (within 24pt, so terminals that snap to whole character cells still count). With it on, a maximized window sharing a half's corner is not stacked with the half, and the hover list shows the stack the shortcuts would cycle from its front window. The Todo window is left out of cycling, as in the other multi-window actions. A cycling session keeps its anchor, ring order and a logical cursor for as long as the focus stays in the stack. That way both directions visit every window, rapid presses each advance, and a window whose app refuses to raise it is stepped past rather than retried. Raises run off the main thread with AX timeouts. Only the latest one runs, and its app is activated only while the user is still among the cycle's apps. The cascade math moves into StackBadgeGeometry so the hover list and cycling share it.
bc9441d to
090ca9a
Compare
|
Nice work - this fills the one gap the hover list leaves: once the list is open you can walk it with the arrows and Return, but there's no way to open it without the mouse. Cycling covers that nicely. On size: the hover list is deliberately size-agnostic because it moves nothing. It only lists what's pegged to that corner, so a maximized window over a half belongs in the list. Keeping "same size" as an opt-in, off by default, preserves that, and having one setting drive both makes sense to me. One idea for later, not for this PR: a shortcut that opens the hover list at the focused window's stack would give keyboard users the whole list, not just next/previous. |
|
Thanks both! @rxhanson, good call on the discrepancy. I've pushed an Only stack windows of the same size setting under Stacked Windows that the hover list and the cycle shortcuts both follow. It's off by default, so the hover list behaves exactly as it does today, and cycling then includes every window pegged to that corner (for example, a maximized window over a half). With it on, both only stack windows of the same size, and the hover list shows the same stack the shortcuts would cycle from its front window. The PR description has the details. Happy to change the naming, default or placement. And no worries about the test! @MyronKoch, thanks for the context. That's exactly why I kept same-size opt-in and off by default. A shortcut that opens the hover list at the focused window's stack is a great idea, and I'm happy to take it on in a separate PR once this one lands. One more thing I'd be open to implementing: support for mapping actions to mouse buttons, like the side buttons on many mice. It would pair nicely with cycling, for example stepping through a stack with the thumb buttons. |
|
I tested this out and did a quick walk through the code. Looks good! I'm going to give it a little more thorough walk through the code first thing tomorrow. |
|
Thanks! I love Rectangle and use it every single day. It makes my 49" Ultrawide monitor infinitely better. I would love to keep contributing. |
|
Thanks for contributing! I forgot to mention that the mouse button idea sounds good to me if you end up working on it. |
Discussion: #1884
What this adds
Two new actions, Cycle Stacked Windows and Cycle Stacked Windows Backward. Each press brings forward one window from the focused window's stack, so you can reach windows hidden behind others in the same spot without the mouse.
cycle-stacked-windowsandcycle-stacked-windows-backward.How it behaves
Other changes
StackBadgeGeometry, so the hover list and cycling share it. With the new setting off, the hover list behaves exactly as before.ShortcutRecordingObserver.MASShortcutViewRepresentablecan now take that observer; the view is let go of when SwiftUI removes it, so collapsing the section mid-recording doesn't leave a hidden recorder active.AccessibilityElement.raise()(AXRaise) andTodoManager.getTodoWindowId().Testing
StackCycleTestscovers stack membership (cascades, maximized and quarter windows at the same corner, terminal-sized windows) and cycle order in both directions. It also covers presses made before a raise lands, raises that land partway through a run of presses, refused raises, and switching between stacks. A newShortcutRecordingObserverTestscase covers letting go of a recording view.main: the test target doesn't compile at the moment.DisplayTransferTests.transferreturnsDisplayTransfer.transferredRect(...), which now returns a tuple, so it needs a.rect. I patched that locally to run the suite; it isn't part of this PR, but I can open a separate one.