You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to make my app return to its last position after closing and opening. To do this, I save the position returned by getWindowPosition to persistent storage, and then use this code to restore its position when launching:
The position is restored correctly on my primary monitor, but wrongly on my other monitors. This is my monitor setup:
My main monitor has a scale factor of 175%, and it seems that when it restores onto my other monitor, its being placed at a position thats (1.75*correct x, 1.75*correct y).
Placing it on monitor 3, position before closing:
Position after reopening and nudging it:
I am currently using v0.4.3
UPDATE:
Without changing anything, it now usually positions correctly but sizes incorrectly. Here is the value of the Size its being set to vs the size from windowManager.getSize():
I tried to build window_manager locally so I could figure out what the issue is, but using the latest state of main, the positioning works fine, but the application is incorrectly sized (probably 1/1.75 times too small), having made no changes to the code. I don't see changes in any of the commits since v0.4.3 that I would expect to make this behave differently either.
Update: Even after switching back to the pub version, it was still wrong size, right place. Even after restarting, still wrong size right place. Then today (the next day), I ran the executable directly (the same from yesterday), and it was right size, wrong positioning. I rebuilt it and wrong size right place again from VSCode and the direct executable.
So it seems to be inconsistent which one behaves correctly, but it seems to usually be wrong size right position usually.
Fenekhu
changed the title
[Windows] setWindowPosition incorrect position with second monitor and scale factor
[Windows] setWindowPosition incorrect position or size with second monitor and scale factor
Mar 10, 2025
My current workaround is to multiply the dimensions beforehand using the screen_retriever package (which window_manager is already dependent on), based on the workaround for #456
I'm trying to make my app return to its last position after closing and opening. To do this, I save the position returned by getWindowPosition to persistent storage, and then use this code to restore its position when launching:
The position is restored correctly on my primary monitor, but wrongly on my other monitors. This is my monitor setup:

My main monitor has a scale factor of 175%, and it seems that when it restores onto my other monitor, its being placed at a position thats
(1.75*correct x, 1.75*correct y)
.Placing it on monitor 3, position before closing:


Position after reopening and nudging it:
I am currently using v0.4.3
UPDATE:
Without changing anything, it now usually positions correctly but sizes incorrectly. Here is the value of the Size its being set to vs the size from
windowManager.getSize()
:The text was updated successfully, but these errors were encountered: