TANWindowMgr icon indicating copy to clipboard operation
TANWindowMgr copied to clipboard

Applications that are snapped does not restore properly

Open Cra7y opened this issue 4 years ago • 7 comments

I tried to save 4 applications which were snapped the corners of the screen using the windows snapping feature. When restored this left the windows jumbled. However when the applications are manually resized and placed in the same fashion and saved, restoring works as expected.

Otherwise, thanks for the great software. Easy to use and does the job!

Cra7y avatar Oct 14 '20 22:10 Cra7y

I just noticed the same behaviour, but discovered, that loading the profile twice does the trick for me. Some of the snapped windows do have the correct upper left coordinates but not the right size. Loading the profile again finishes the job in my case.

sum5l avatar Feb 24 '21 10:02 sum5l

Interesting, I tried the double profile load you suggested and it didn't work for me. But no matter I think I have this problem fixed for real. After some more research I found by using the GetWindowRect API function I can reliably get the position/size of snapped windows. I'm continuing to use GetWindowPlacement to get the maximized/minimized state. The GetWindowPlacement function only reports the most recent restored size and has no awareness of snapping. In my testing this seems to work perfectly, let me know if this works for you. The latest 1.4 release has these changes https://github.com/Todd1561/TANWindowMgr/releases/tag/1.4

Todd

Todd1561 avatar Feb 24 '21 14:02 Todd1561

Oh I see. I assumed the cmd line and the gui profile load would call the same function or at least work in the same way.

With the 1.4:

  • using the systray-menu > Load "Messengers" (my profile name) works as expected and positions all windows correctly.
  • calling "TANWindowMgr.exe -restore="Messengers" -autoexit" positions the left upper corner correctly, but width and height arent right. Executing the same cmd again just fixes width and height.

Messenger,3840,5,650,5040,1,Messengers Discord,3840,650,1254,5040,1,Messengers Telegram,3840,1254,1885,5040,1,Messengers

Thats my .ini file for this profile; the resolution for this display is 1200x1920, but I can't make too much sense of the coordinates. Should I save the window positions again with the 1.4?

sum5l avatar Feb 24 '21 14:02 sum5l

Yes the cmd line and GUI use the same function to save/restore windows, there should be no difference. And yes, you need to reposition your windows and re-save the profile for these fixes the take effect, sorry I should have made that clear. The issue was on the saving side, not the reposition side, so your original file was not made correctly if it had snapped windows.

I'm not sure why you'd be seeing different behavior between cmd line and GUI. But start by regenerating your file and try both methods and let me know if it's consistent.

Todd1561 avatar Feb 24 '21 15:02 Todd1561

Re-saving the positions in the same or another profile doesn't help. I also discovered, that

  • loading a profile with target windows minimized works fine
  • loading a profile with target windows moved away from the desired position has the effect I described (double load fix)

this applies both to GUID and CMD usage. So the difference isnt the GUI/CMD but the state of the window? Probably?

sum5l avatar Feb 24 '21 16:02 sum5l

Hmm I'm not sure what to suggest, I've tried everything you've described and can't reproduce that behavior with the 1.4 release with either the cmd usage or GUI. I have 4 monitors with 3 different screen resolutions and have snapped windows to the sides of different screens and they all restore properly. Only thing I can think of is there being something odd with the programs you're trying to use with this, I don't have any of those 3 listed to test with. The only instance of an app-specific issue did ironically involve Discord, but that was fixed some time ago in this issue https://github.com/Todd1561/TANWindowMgr/issues/1

Maybe try snapping a couple generic apps like Notepad or Chrome and test?

Todd1561 avatar Feb 24 '21 20:02 Todd1561

This also does not work for me, but rather than default snapped windows I am using the Windows PowerToys layout feature. When restoring, the windows get back slightly below the position they have been at before. Also, it would be great if closed windows would be reopened automatically, so that you do not have to open them yourself manually.

janmagnusdev avatar Dec 08 '21 08:12 janmagnusdev