Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • April 24, 2017, 12:26:43 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Desperate app request - restore window positions after wake from sleep scrambles  (Read 384 times)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,921
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
This thread describes a problem that quite a few people seem to be suffering from, where window positions get scrambled on multi-monitor setups when the monitors wake up from sleep:
http://www.donationc....msg407109#msg407109

It doesn't happen and I think it's some side effect of some monitors not waking up fast enough.

The app will have to do the following:
1. Periodically store the positions of all windows on screen.
2. Detect when the monitors wake up from sleep.
3. After some delay after waking up, automatically restore the window positions (including maximization state, etc.)
4. I'm guessing it will need some way of allowing user to exclude certain apps from processing (i'm guessing some apps might misbehave or have hidden windows that shouldn't be processed, etc.)

Lintalist

  • Participant
  • Joined in 2015
  • *
  • Posts: 45
    • View Profile
    • Lintalist
    • Donate to Member
Haven't tried it but here is a "AutoHotkey script that will save your window positions and then restore them to the saved position" https://github.com/KroniK907/WindowSaver

I'm assuming it has to be slightly modified to say safe window positions every X minutes - there is a wrapper for power events here https://autohotkey.c...events-like-standby/ which may proof useful if you want it fully automated. Otherwise adding a hotkey to "restore" the latest state quickly after a sleep is probably easier :)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,921
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Nice find, Lintalist.
That looks like it's 95% of the solution.
Now if I can just get one of the ahk coders here to add the other 5% I'll be golden.  :up:

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,699
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
Now if I can just get one of the ahk coders here to add the other 5% I'll be golden.

Would this work for about 2.5%?

http://www.donationc...60.msg34720#msg34720

In other words, launching the AHK script after a set length of user idle time, but a shorter than when your monitors would go to sleep (almost like a screensaver)?

Then all you'd need is something to run it to restore, after a set length of time after user activity is detected, just slightly longer than it takes for your monitors to fully wake up.


This does what you need: http://www.donationc...60.msg34720#msg34720

Can be used to set the timeout to run the ahk script after a set length of user idle time, and then run to restore the windows after keyboard/mouse activity detected. It does both, so now you have your 100%. :)
« Last Edit: April 14, 2017, 10:18:40 AM by app103, Reason: found something better »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,921
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
I'm not sure.. I think still missing is something that restores window positions only after the monitors wake up from sleep, and then after some delay..

And the procedure for saving window positions -- since it's going to be happening so frequently, it would be nice if it was all one process rather than something launching another exe every 30 seconds..

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,699
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
What causes the monitors to wake? User activity?

How long do they take to wake after keyboard/mouse activity?

Set the time to wakeup time + 5 seconds before running the restore.

That way, if you move the mouse or tap any key on the keyboard, it will then wait long enough for your monitors to wake, before running the restore.