microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.27k stars 6.55k forks source link

Awake not working #12326

Closed eirinn1975 closed 1 year ago

eirinn1975 commented 3 years ago

Microsoft PowerToys version

0.41.4

Running as admin

Area(s) with issue?

Awake

Steps to reproduce

Awake doesn't work out of the box for me. I selected stay awake for two hours, and after the usual "sleep" time the computer went off. Secondarily, I can't change the setting from the tray area icon, it just reflects what is set in the app itself.

✔️ Expected Behavior

should keep the computer alive

❌ Actual Behavior

computer goes to sleep mode regardless of the setting.

Other Software

No response

dend commented 3 years ago

For the tray, this is tracked in #12145.

Can you clarify what the "usual sleep time" is? How did you select the 2 hour limit for Awake?

eirinn1975 commented 3 years ago

Sorry if it wasn't clear. I've selected keep computer awake for the next 2hrs from the power toys main window app, under awake section. By usual sleep time (in my case after 20 idle minutes the computer goes to suspend mode) I meant the sleep time is specified in the windows settings in power management.

dend commented 3 years ago

I can't reproduce this on my machine - can you share your logs, please? What is the version of PowerToys that you are using?

eirinn1975 commented 3 years ago

As stated in the first message, version is 0.41.4. Where can I find the logs? I've tried looking in the PowerToys folder but haven't found anything

jaimecbernardo commented 3 years ago

Hi @eirinn1975 , The logs would be included in a bug report. Could you please send one?

Right-click on the PowerToys icon in the tray menu and select Report Bug image Drag and drop report into a GitHub comment.

Thank you!

eirinn1975 commented 3 years ago

PowerToysReport_2021-07-15-14-30-10.zip There you are :)

dend commented 3 years ago

Looking at the logs, I don't see the timed keep-awake ever kicking in. Specifically, the last line in the app log is:

[2021-07-15 14:29:59.4582 INFO Awake.Core.APIHelper] Initiated indefinite keep awake in background thread: 25464. Screen on: False

This echoes what's in the Awake settings (see AwakeMode for reference on number mapping):

{"properties":{"awake_keep_display_on":false,"awake_mode":1,"awake_hours":2,"awake_minutes":0},"name":"Awake","version":"1.0"}

Which tells me that somehow the setting did not take effect. @eirinn1975 - can you try switching modes (from indefinite back to timed), and see if the issue persists?

eirinn1975 commented 3 years ago

I'll make some tests today. Is the awake feature based on some service?

eirinn1975 commented 3 years ago

After a few tests: I set up suspension and screen off to 1 minute. turned on the awake function for both screen and indefinite time on awake. screen worked, and suspension avoided. I then turned off the keep screen awake function, it worked (screen went black). Then I disabled awake, and the computer stayed on. Seems now I'm in the opposite situation...

Here is the log after these tests. PowerToysReport_2021-07-19-08-54-53.zip

MountainDudeWV commented 3 years ago

I am having the same issue on my machine running Win11

weoinvm commented 3 years ago

Having the same issue win 10

dend commented 3 years ago

@weoinvm can you please provide some context as to what you are trying to do, what behavior you are seeing, and what system configuration do you have?

K0media commented 3 years ago

I'm facing the same issue. I thought they've fixed it on the latest releases, but perhaps it's working the same way as before.

I'll provide logs soon, but I'll have to clear things first and generate a fresh one.

However, I believe this issue is related to system lock/hibernate settings/effects, not after a new startup.

I hibernate my machine a lot, and attempted to run it while I watched some stuff on Telegram Desktop, but the screen turns off even the setting of 1/2 hours is turned on.

What do you guys need besides the activity/dump logs? Anything else I could help you with to figure this out?

Jay-o-Way commented 3 years ago

@dend Any update? Since it's labeled prio-1 and 0.49 is around the corner...

dend commented 3 years ago

No major update yet as I haven't been able to pinpoint the issue. We might get it out post-0.49 as I am in the process of drafting up the spec for the next Awake version.

ned-martin commented 2 years ago

I have the same problem.

Awake does not keep the computer awake. Does not appear to make any difference what I set it to. Computer goes to sleep after the usual amount of time.

(I realise this isn't a particularly helpful report - let me know if you want logs or anything - I'm just adding it here to indicate that I'm another person finding that this tool doesn't do what it's designed to do)

ironboy1 commented 2 years ago

Same behavior with my Surface Book 2...

manic232 commented 2 years ago

Just to put in my two penny's worth. I am having the same issue with Windows 11 (all updates as of 12 Dec 2021) and Awake 0.51.1. After some work I think the issue only happens after the PC awakes from a sleep state. It works fine after a cold start. I hope this helps find the issue.

CRi83 commented 2 years ago

I have same issue here on one computer.

Maybe it's related to Modern Standby (S0 power state), because it works without issue on other computers that don't support modern standby...

Jay-o-Way commented 2 years ago

@dend Do you know if both sleep and hybernation should be prevented? Since they are different settings and the latter one is buried deep in advanced System Configuration settings... image

abenneke commented 2 years ago

Happy and Healthy New Year!

I just ran into this issue - but under different/very specific circumstances - so perhaps my observations could help to solve this:

What I'm trying to do is to use Awake to prevent sleep mode while doing a backup from a remote server via rsync:

(1) wake up sleeping computer via magic packet/wakeonlan (2) connect via ssh (Cygwin), start Awake to keep it in this state (3) run backup (ssh/rsync) (4) connect via ssh (Cygwin), kill Awake (5) computer resumes sleeping

I've been using this setup (with DontSleep instead of Awake) for years on various other/older laptops.

However, with my newest laptop this starts to behave "strange":

The above flow still works like a charm when the computer is not yet sleeping in the first place.

BUT: It reproducibly fails when it has just been woken up by (1):

Observations:

What eventually "fixed" it for me was a BIOS setting: There is a "Sleep State" option in the BIOS, with two settings:

Using the default "Windows and Linux" I see the above behavior, however switching this to "Linux S3" things are working (again) as expected!

My conclusion: @CRi83 could be pointing in the right direction: When Windows is (already) in S0 "sleep" mode, it seems to ignore (changes to) SetThreadExecutionState!?

To prevent this, Awake could try to "wake the computer up completely" (whatever that means) before setting SetThreadExecutionState?

dend commented 2 years ago

Interesting - thank you for the observation and detailed report @abenneke. I am currently investigating if there is a way to do this.

dend commented 2 years ago

An interesting tidbit in the official docs:

Windows prevents desktop applications from running during any part of modern standby after the DAM phase completes.

Wonder if this has anything to do with observed behavior. It also seems like I need to expand logging to see when the behavior occurs before this can be addressed, and for that I need to get the SYSTEM_POWER_STATE. Just need to figure out which API returns that.

Morgy93 commented 2 years ago

Does not work for me as well.

If I set "Keep screen on" to true, then the display still goes dark after predefined time.

The logs constantly state:

[2022-03-11 20:16:18.3749 INFO Awake.Program] Detected a settings file change. Updating configuration...
[2022-03-11 20:16:18.3749 INFO Awake.Program] Resetting keep-awake to normal state due to settings change.
[2022-03-11 20:16:18.3749 INFO Awake.Program] Operating in passive mode (computer's standard power plan). No custom keep awake settings enabled.

So it seems that it acutally never enables the keep-awake state?

Anything I can do to help debug the issue?

dend commented 2 years ago

@Morgy93 are you setting a specific mode of operation other than passive after setting the display on? Are you doing this through the tray or the PowerToys settings?

Also - what OS version do you have?

Morgy93 commented 2 years ago

@Morgy93 are you setting a specific mode of operation other than passive after setting the display on? Are you doing this through the tray or the PowerToys settings?

Also - what OS version do you have?

OS: Windows 11 Home 21H2 22000.556

I used the tray icon and only enabled "Keep screen on". I'll see if it makes a difference if set via PowerToys directly. PowerToys is not run with administrator privileges.

Edit: It seems to work if I also change the power plan accordingly - is this intended or a bug? If intended, the UX should be improved. It does not seem to make a difference if set via tray icon or PowerToys directly.

dend commented 2 years ago

@Morgy - "Keep Screen On" should only work when you have the active mode selected (either timed or indefinite) and not passive. I'll think through this a bit more from the UX perspective - maybe the option should not be available to keep the display on unless you've selected a compatible mode.

Morgy93 commented 2 years ago

@morgy - "Keep Screen On" should only work when you have the active mode selected (either timed or indefinite) and not passive. I'll think through this a bit more from the UX perspective - maybe the option should not be available to keep the display on unless you've selected a compatible mode.

Yes, that would be great! Shall I open another issue for it? That makes it clear so that the option is bound to an enabled Awake state.

dend commented 2 years ago

@Morgy93 yes please - a new issue would be great here.

marcelgood commented 2 years ago

Glad I found this. So looks like this PowerToy isn't working at all. I tried to keep my Surface Book 3 awake to test something while I was away, but my test failed and apparently because Awake didn't keep the machine awake. The Event log shows that my Surface Book entered connected standby mode regardless. I think this tool doesn't work with modern standby.

The system is entering connected standby 

Reason: Idle Timeout.
marcelgood commented 2 years ago

So apparently setting "Put the computer to sleep" to "Never" in the regular power options doesn't work, either. It still goes to connected standby. Now I'm wondering if it has something to do with Dynamic lock, which I've configured. According to the System log, it goes to connected standby as soon as I walk away with my phone.

marcelgood commented 2 years ago

It's possible that I may have just figured out what's going on. I enabled the group policy to allow apps to prevent automatic sleep. By default the policy doesn't allow it. It seems to have worked. YMMV, but at least for the tests I just did my machine stayed awake.

Screenshot 2022-11-06 160220

schnodo commented 2 years ago

I enabled the group policy to allow apps to prevent automatic sleep. By default the policy doesn't allow it. It seems to have worked.

It seems to have worked for me, too. Thank you!

dend commented 1 year ago

This seems to have been addressed. That said, @marcelgood @schnodo - I am tagging this item for myself to address in documentation as well, since it's a good way to get tripped up if you don't actually have the GPO set up. Thank you for the feedback!

padevel commented 1 year ago

The ticket's closed but...what about those of us with Home editions of Windows. Any tips?

dend commented 1 year ago

@padevel if the app is not working for you, please open a new issue with repro steps along with system details 👍

bdforbes commented 1 year ago

@dend I don't see anything at https://learn.microsoft.com/en-us/windows/powertoys/awake about the group policy setting - is it still expected that we need to do this in order for Awake to work properly?

looeee commented 1 year ago

For anyone else having this issue with Windows 11 Home Edition. I think I found the issue.

If I go to the Control Panel -> Changed Advanced Power Settings, I can see that I have Sleep set to Never. However, Hibernate was still set to 15 minutes and sure enough the computer was powering down after fifteen minutes even with Powertoys Awake set to "indefinite".

TomRaraAvis commented 1 year ago

For anyone else having this issue with Windows 11 Home Edition. I think I found the issue.

If I go to the Control Panel -> Changed Advanced Power Settings, I can see that I have Sleep set to Never. However, Hibernate was still set to 15 minutes and sure enough the computer was powering down after fifteen minutes even with Powertoys Awake set to "indefinite".

Yep; same for me! Changed hibernate settings and finally stayed awake. Thanks for posting @looeee !

pucgenie commented 11 months ago

Hibernate setting disabled for AC (battery was set to 400000min or so), standby setting disabled for AC, gpedit allow apps to keep awake system in AC enabled, rebooted... Powertoys Awake set to "indefinite" and enabled. System still enters Modern Standby when locking the screen (log: Idle Timeout). Completely preventing standby via firmware option works but is undesired. Do you want me to create a new issue ticket?

EDIT 2024-03-29: It works somehow, just not as I thought it would, e.g. sound continues to be playing, but event log says modern standby nonetheless

pesa79 commented 7 months ago

On Windows 11 awake does not work in any way. The question is, why are you releasing a version that doesn't fulfill a basic function? How long have people been writing to you saying it doesn't work? Might want to ask some of the apple developers for help on how to do things. Maybe you should be honest with yourself, not do things you don't understand, and then when you don't know what to do with yourself, please... recruit yourself to Ukraine and hopefully you'll serve better there. You're nobodies in this business. Useless.