Open TonyWW opened 2 years ago
notes: desktop w/ bluetooth keyboard, both win11 + PT Run act same.
may need to look at last var from NativeMethods.SetSuspendState and flip to false
laptop can confirm behavior from @tonyww. May be just as simple as tweaking https://github.com/microsoft/PowerToys/blob/main/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Main.cs#L159
to false, false, false or false, true, false
I'll try it
May be just as simple as tweaking to false, false, false or false, true, false
Unfortunately that's not so simple.
The call to SetSuspendState
puts machine in Sleep or Hibernate, but both states require Power button click,
What we're trying to achieve is StandBy state.
Both calls goes
Rundll32.exe Powrprof.dll,SetSuspendState Sleep
Rundll32.exe Powrprof.dll,SetSuspendState Standby
Investigated Explorer handling "Sleep" button.
Dump with API Monitor shows several calls to NtPowerInformation
.
It is unclear how to reproduce Explorer behavior.
Probably the right thing would be call to undocumented NtInitiatePowerAction
.
@lncubus , did you try anything else?
Should be the same thing as https://github.com/microsoft/PowerToys/issues/10557
I used SleepOnLan and found 'sleep' actually hibernates #10557 which is dup of this issue.
C:\\Windows\\System32\\rundll32.exe powrprof.dll,SetSuspendState 0,1,1
Note: My PC comes with tranditional sleep (entering S3 state) not modern sleep (entering Modern Standby).
Microsoft PowerToys version
v0.55.2
Running as admin
Area(s) with issue?
PowerToys Run
Steps to reproduce
in PowerToys Run, type sleep, hit Enter. Then hit any keys on the external usb keyboard to try wake the laptop.
✔️ Expected Behavior
the PowerToys Run "sleep" should behave the same as the one that you on the Windows menu Power option. Or provide a setting to be the same.
❌ Actual Behavior
cannot wait laptop with usb keyboard
Other Software
No response