RectanglePro-Community icon indicating copy to clipboard operation
RectanglePro-Community copied to clipboard

Restoring an App Layout with multiple windows swaps the focussed window

Open drunkenplatypus opened this issue 5 months ago • 2 comments

Love the app!

I use App Layouts as a way to quickly bring an app to the foreground with a keyboard shortcut. When I restore a layout of an App e.g. Chrome, and there are multiple Chrome windows open, it switches between the different Chrome windows instead of just bringing up the one I had in the foreground before I tabbed to another app or switched to another App Layout.

e.g. Say I have 2x Chrome windows & 2 VSCode windows, I have Chrome1 in the foreground and I use a bind to open the App Layout for VSCode, I now see VSCode1. If I then press my Chrome bind I see Chrome2, and if I press my VSCode bind again I see VSCode2.

In this situation I would always want to see Chrome1 and VSCode1, unless I specifically switched to a different window with "cmd-`". Basically as if I was tabbing between the 2 (Chrome & VSCode).

Thanks in advance.

macOS version: Sonoma 14.2 Rectangle version: 3.0.19 (160)

drunkenplatypus avatar Mar 11 '24 15:03 drunkenplatypus

Thanks for reporting. There was a fix that I put into v3.0.19, where app layouts will now take into account title characteristics of a window, if possible, to properly correlate which window is being saved/restored. If you created your app layout prior to v3.0.19, then you would have to re-create each app layout to take advantage of this. Rectangle Pro will first place all windows that correlate by title, and then fall back on the previous way, which is taking what macOS gives back as the highest z-index matched with each window of an app layout down to the lowest. This means that the issue you're seeing could be due to some ambiguity as to what macOS is giving back in terms of z-index, or more likely, if the layout is being applied to multiple windows of the same app, then it's up to macOS as to which ones are brought frontmost more quickly than others. Possible solutions include: make it so only the frontmost window of an app is brought frontmost, or have some sort of delay that better guarantees order.

rxhanson avatar Mar 12 '24 05:03 rxhanson

Thanks for responding. I only installed for the first time at v3.019, but I've recreated the App Layouts and am still seeing the problem.

I've captured this video that shows what I'm seeing, it appears as though it's going through each VSCode window 1->2->3->4->5 and the inverse each time I press the hotkey. I see this behaviour pressing the hotkey multiple times and when switching from another app.

If this is just some quirk with MacOS then so be it, thanks for your help.

https://github.com/rxhanson/RectanglePro-Community/assets/39083574/aa9bad1c-8ce1-4708-aabe-e4972ba77a38

drunkenplatypus avatar Mar 13 '24 00:03 drunkenplatypus