From dea0b81b81e29fd6eb55f6a4a4a2bdcc048551dc Mon Sep 17 00:00:00 2001 From: kroimon Date: Wed, 26 Aug 2020 10:15:26 +0200 Subject: [PATCH] Add SetLidActionNone, SetLidActionSleep, SetLidActionHibernate and SetLidActionShutDown to change what happens when a laptop lid is closed. --- Default.preset | 1 + Win10.psm1 | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Default.preset b/Default.preset index d73b0db2..d4a4f597 100644 --- a/Default.preset +++ b/Default.preset @@ -116,6 +116,7 @@ EnableNTFSLongPaths # DisableNTFSLongPaths # EnableHibernation # DisableHibernation # DisableSleepButton # EnableSleepButton # DisableSleepTimeout # EnableSleepTimeout +# SetLidActionNone # SetLidActionSleep # SetLidActionHibernate # SetLidActionShutDown # DisableFastStartup # EnableFastStartup # DisableAutoRebootOnCrash # EnableAutoRebootOnCrash diff --git a/Win10.psm1 b/Win10.psm1 index f6d71ecb..f50b8d76 100644 --- a/Win10.psm1 +++ b/Win10.psm1 @@ -1765,6 +1765,30 @@ Function EnableSleepTimeout { powercfg /X standby-timeout-dc 15 } +# Set lid closing action to Do Nothing +Function SetLidActionNone { + Write-Output "Setting lid closing action to Do Nothing..." + powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_BUTTONS LIDACTION 0 +} + +# Set lid closing action to Sleep +Function SetLidActionSleep { + Write-Output "Setting lid closing action to Sleep..." + powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_BUTTONS LIDACTION 1 +} + +# Set lid closing action to Hibernate +Function SetLidActionHibernate { + Write-Output "Setting lid closing action to Hibernate..." + powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_BUTTONS LIDACTION 2 +} + +# Set lid closing action to Shut Down +Function SetLidActionShutDown { + Write-Output "Setting lid closing action to Shut Down..." + powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_BUTTONS LIDACTION 3 +} + # Disable Fast Startup Function DisableFastStartup { Write-Output "Disabling Fast Startup..."