rxhanson / Rectangle

Move and resize windows on macOS with keyboard shortcuts and snap areas
https://rectangleapp.com
Other
25.72k stars 767 forks source link

screen mirroring interferes with sizing #1218

Closed zacthompson closed 1 year ago

zacthompson commented 1 year ago

macOS version: 12.6 Rectangle version: 0.69

workaround: For now, I'm just not doing the mirroring.

I'm using an external monitor and I usually keep my macbook open (for the camera to be usable if desired). But because my main monitor is so wide (34" : 3440x1440), I don't like to have app windows on the small laptop screen: I'd surely miss notifications or whatever. So I set up the macbook display to act as a mirror of the external monitor. Note: not the other way around -- the screen resolution is optimized for the external monitor, and a scaled copy of it shows on the laptop screen.

When I try to resize an app window to thirds, halves, or other layouts, the window flashes and partially resizes, but not to the extent intended. I can get close (but seemingly not 100% there) by punching the hotkey repeatedly (many times).

Logs did not provide much useful insight: the coordinates shown would have been accurate if they had actually taken effect. Repeated triggering of the resize just shows the exact same sizing/position in the logs, even though the window approaches the actual target size more closely with each invocation:

2023-07-28T23:10:10-07:00: AX sizing proposed: (1146.0, 1415.0), result: (1146.0, 1415.0)

Perhaps of interest: when mirroring, the "single" screen is only shown in the Rectangle logs as "Built-in Display". This is different than what is shown when I have both screens active (which is either "Built-in Retina Display", or the monitor model name):

2023-07-28T23:16:24-07:00: nextDisplay | display: (0.0, 0.0, 1792.0, 1095.0), calculatedRect: (323.0, 25.0, 1146.0, 1095.0), resultRect: (323.0, 25.0, 1146.0, 1095.0), srcScreen: DELL U3421WE, destScreen: Built-in Retina Display, resultScreen: Built-in Retina Display

rxhanson commented 1 year ago

Sorry for the delayed response; thanks for the detailed report. I haven't been able to reproduce this. I tried mirroring my larger display to a smaller one and vice-versa, and Rectangle is functioning properly. There are a few missing log lines here, where for each attempt to move/resize a window there would be a resize, move, and another resize. Perhaps including all of the logs for move/resize action would paint a clearer picture of which step is failing here?

Since I can't reproduce it, we could be looking at an edge case of the accessibility API that could be hard to narrow down.

zacthompson commented 1 year ago

Strangely, I now can't reproduce it either. And the bizarre "Built-in Display" screen name is no longer shown either. My nice working mirroring now shows only my external screen, as I would expect:

2023-08-02T07:37:41-07:00: AX sizing proposed: (1146.0, 1415.0), result: (1146.0, 1415.0) 2023-08-02T07:37:41-07:00: AX position proposed: (0.0, 25.0), result: (0.0, 25.0) 2023-08-02T07:37:41-07:00: AX sizing proposed: (1146.0, 1415.0), result: (1146.0, 1415.0) 2023-08-02T07:37:41-07:00: firstThird | display: (0.0, 0.0, 3440.0, 1415.0), calculatedRect: (0.0, 25.0, 1146.0, 1415.0), resultRect: (0.0, 25.0, 1146.0, 1415.0), srcScreen: DELL U3421WE, destScreen: DELL U3421WE, resultScreen: DELL U3421WE

Unless it was a truly exceptional glitch, I have to guess it was due to some specific order of connecting things and/or turning them on and/or opening them. If it happens again I'll see if I can work out what sequence induces it before reopening this bug report.

zacthompson commented 1 year ago

Hmmm happened again but in this case it was after a restart due to a crash... it's possible I have hardware issues. But if you want to try to repro it again, maybe try setting up the mirroring as I described and then restarting the mac.

Anyway here's the result of hitting the "firstThird" shortcut three times:

2023-08-04T00:10:37-07:00: AX sizing proposed: (1146.0, 1415.0), result: (1146.0, 1230.0) 2023-08-04T00:10:37-07:00: AX position proposed: (0.0, 25.0), result: (0.0, 25.0) 2023-08-04T00:10:37-07:00: AX sizing proposed: (1146.0, 1415.0), result: (1146.0, 1415.0) 2023-08-04T00:10:37-07:00: firstThird | display: (0.0, 0.0, 3440.0, 1415.0), calculatedRect: (0.0, 25.0, 1146.0, 1415.0), resultRect: (-0.0, 25.0, 1146.0, 1415.0), srcScreen: Built-in Display, destScreen: Built-in Display, resultScreen: Built-in Display 2023-08-04T00:10:38-07:00: AX sizing proposed: (1146.0, 1415.0), result: (1146.0, 1322.0) 2023-08-04T00:10:38-07:00: AX position proposed: (0.0, 25.0), result: (0.0, 25.0) 2023-08-04T00:10:38-07:00: AX sizing proposed: (1146.0, 1415.0), result: (1146.0, 1415.0) 2023-08-04T00:10:38-07:00: firstThird | display: (0.0, 0.0, 3440.0, 1415.0), calculatedRect: (0.0, 25.0, 1146.0, 1415.0), resultRect: (-0.0, 25.0, 1146.0, 1415.0), srcScreen: Built-in Display, destScreen: Built-in Display, resultScreen: Built-in Display 2023-08-04T00:10:38-07:00: AX sizing proposed: (1146.0, 1415.0), result: (1146.0, 1368.0) 2023-08-04T00:10:38-07:00: AX position proposed: (0.0, 25.0), result: (0.0, 25.0) 2023-08-04T00:10:38-07:00: AX sizing proposed: (1146.0, 1415.0), result: (1146.0, 1415.0) 2023-08-04T00:10:38-07:00: firstThird | display: (0.0, 0.0, 3440.0, 1415.0), calculatedRect: (0.0, 25.0, 1146.0, 1415.0), resultRect: (-0.0, 25.0, 1146.0, 1415.0), srcScreen: Built-in Display, destScreen: Built-in Display, resultScreen: Built-in Display

Notice that the first "AX sizing" of each block (not sure why there are two each time) was what the actual window size ended up being after the flicker.

Workaround is now to simply disconnect and reconnect the external monitor.