Skip to content

Feature proposal (I'd implement it): bring windows tiled together forward together #1985

Backlog

Description

@janfabig

The problem

I tile windows of different apps next to each other with Rectangle, for example an editor on the left half and a browser on the right half. When I later switch to one of them with Cmd-Tab, AltTab, the Dock or a click, only that window comes forward. Its neighbour stays buried under whatever I used in between, so I switch twice to get the layout back.

The proposal

When a window that Rectangle tiled becomes active, Rectangle also brings forward the windows it tiled next to it on the same display. The window the user picked stays focused and on top. The feature is off by default.

  • Which windows belong together: windows whose current frame still equals the frame Rectangle last gave them (WindowHistory.lastRectangleActions), on the same screen, connected by shared edges. Rectangle already keeps this record, so the feature needs no new state.

  • Leaving a group: moving or resizing a window by hand changes its frame, so it no longer matches its recorded action and drops out of the group on its own.

  • When it runs: on NSWorkspace.didActivateApplicationNotification for app switches (as TitleBarManager and NewWindowActionManager already observe), and on kAXFocusedWindowChangedNotification for switches between windows of the same app.

  • How it raises: kAXRaiseAction on each group member that is hidden by a window outside the group, then once more on the picked window. A raise lifts a background app's window without taking focus. Members that are already visible are left alone, which avoids flicker.

  • Setting: a hidden default in the style of cooperativeCornerResize, documented in TerminalCommands.md:

    defaults write com.knollsoft.Rectangle raiseTiledWindowsTogether -bool true
    

What I learned building it outside Rectangle

I built this as a small standalone helper, Tessera, and use it daily next to Rectangle and AltTab. Outside Rectangle it has to guess groups from window positions, which is where most of its complexity and edge cases come from. Inside Rectangle the snap record answers that question directly. What carried over:

  • Switching apps posts only the activation notification, never a focus change.
  • Our own raises make the raised app report a focus change about 10 ms later. That echo has to be ignored, or the raises loop.
  • Groups have to stay on one display. Otherwise layouts on displays next to each other chain into one big group.

Known limits

  • WindowHistory lives in memory, so after Rectangle restarts, only windows tiled again count.
  • Native tabs (Finder, Terminal, Ghostty) are separate windows with the same frame. A tab brought forward is not in the record, so it raises nothing until it is tiled.

Questions

  1. Would you accept a pull request for this, as a hidden default that is off?
  2. Is raiseTiledWindowsTogether a good name, and should it cover only shortcut actions, or drag-to-snap as well?

If this sounds good, I'll open a pull request with the implementation and tests.

Activity

  1. rxhanson commented on Nov 26, 2026

    @rxhanson
    Owner

    Thanks for looking to contribute this!

    1. Would you accept a pull request for this, as a hidden default that is off?

    Yes, and it makes sense to me to go ahead and add it to the UI in the Behavior tab if you'd like. My next task for Rectangle is to finish going through the existing pull requests, and it may or may not be worth your time looking to see if there are any adjustments to be made with #1903 or #1906, since I'm planning on merging those in once they pass review.

    1. Is raiseTiledWindowsTogether a good name, and should it cover only shortcut actions, or drag-to-snap as well?

    That name works for me.

    As for shortcuts & drag-to-snap, I'm inclined to go with whatever usage you prefer. If you only use it with shortcuts, then let's go with that at a start, as we can always add to it later.

  2. janfabig commented on Dec 2, 2026

    @janfabig
    Author

    Thanks for looking to contribute this!

    Thanks for providing such an amazing app! :)

    Yes, and it makes sense to me to go ahead and add it to the UI in the Behavior tab if you'd like. My next task for Rectangle is to finish going through the existing pull requests, and it may or may not be worth your time looking to see if there are any adjustments to be made with #1903 or #1906, since I'm planning on merging those in once they pass review.

    That sounds reasonable - will also check if there are adjustments to be made with both of the PRs.

    As for shortcuts & drag-to-snap, I'm inclined to go with whatever usage you prefer. If you only use it with shortcuts, then let's go with that at a start, as we can always add to it later.

    Will probably start with shortcuts then but will check if drag-to-snap adds lots of overhead. If not, I'll implement it as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions