winutil/docs/dev/tweaks/Essential-Tweaks/LaptopHibernation.md
MyDrift 5e3c6ba452
[Docs 02] Auto dev-docs & more (#2481)
* Compile Winutil

* pre-Releases (#1)

* Create pre-release.yaml

* Update release.yaml

* Update pre-release.yaml

* Create release-drafter.yml

* Update release-drafter.yml

* Update pre-release.yaml

* Update pre-release.yaml

* Update pre-release.yaml

* Update pre-release.yaml

* Update pre-release.yaml

* Update pre-release.yaml

* Update pre-release.yaml

* Update pre-release.yaml

* Update pre-release.yaml

* Update release-drafter.yml

* Update pre-release.yaml

* Update release-drafter.yml

* Update pre-release.yaml

* Update release-drafter.yml

* Update release-drafter.yml

* Update pre-release.yaml

* Update pre-release.yaml

* Update release-drafter.yml

* Update release-drafter.yml

* Update release.yaml

* Update release-drafter.yml

* Update release-drafter.yml

* Update pre-release.yaml

* Compile Winutil

* fixed end task with right click

* Compile Winutil

* code generator & compile integration

* Compile Winutil

* finish

- add autogenerated table of content page named "Dev Docs", with table of content to all .md files
- added invokescript & undoscript
- generate documentation files

* oops, remove dublicates

* undo winutil.ps1

* remove prefixes

WPF
WinUtil
Toggle
$category
Features
Tweaks
Panel
Fixes

* fixes

- fix inconsistency in Featurenaming
- add "Enable" & "Disable" as prefix to remove

* fix spellin mistake

* remove unneccesary whitespaces

update info
remove unnecessary whitespaces by only adding stuff to the md if it actually exists

* rewrite prefix removal into one line definition

* added taskscheduler support

* add support for function calling

add support for functioncalling
- replace code formatting for invoke & undo script from json to powershell

* content instead of displayname

* add last modified date

* contributing + docs generator

- moved contribute.md to root CONTRIBUTING.md
- referenced CONTRIBUTING.md in contribute.md
- added toggle & button reference to functions
- added function references in functions
- changed mkdocs site styling

* Use HashSet for processedFunctions

Use HashSet for processedFunctions:
- Ensures dynamic addition of functions without duplication.
Recursive Function Scanning:
- Includes all nested functions called by InvokeScript, UndoScript, ToggleScript, and ButtonScript.

* follow github standards

- add code of conduct
- reference code of conduct in docs
- regrouped docs navigation
- add comment about the sourced md file

* small fixes

* change color from teal to blue in light mode

* add links to tweaks

* add archiving feature to autodocs

* administrative

- add script to releases and remove from compile
- move link from after description to after category

* small fixes

- add S in feature.json
- fix dating
- move link to after category

* fix links

* undo link bc of bugs

* add progress bar to script

- add progress like in compile
- moved archive folder creation to the beginning of the script

* Simple improvements to 'auto-devdocs' branch (#3)

* Fix links for tweaks & features

* Make New Line characters work for Json Snippet

* Change NewLine Character from Unix Style (LF) to Windows/DOS Style (CRLF)

* rerun script

* und workflows & rearrange navigation items

* layer out itemname cutout

* rework links & temp removal of archivation

* fix adding link in json root

not adding link member to root in json files

* fix json generation

replace '\r\n',"`r`n" with ('\n',"`n")

* add features to auto md docs

* add minify plugin

* regex hotfix

* refractor

* add changelog to about section

add link to changelog in docs for about section

* undo changelog

* Cleanup 'devdocs-generator.ps1' - Implement Zig Multiline String Feature (#4)

* Cleanup 'devdocs-generator.ps1' - Implement Zig Multiline String Feature

* Fix NewLine character replace in 'devdocs-generator.ps1'

* run script

* run script

* Fix 'itemnametocut' RegEx in 'devdocs-generator.ps1' (#5)

* rerun script

* rework nav + remove code of conduct

* undo workflow changes

* run script

* remove changelog

---------

Co-authored-by: MyDrift-user <MyDrift-user@users.noreply.github.com>
Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
2024-08-07 10:55:23 -05:00

133 lines
4.8 KiB
Markdown

# Set Hibernation as default (good for laptops)
Last Updated: 2024-08-07
!!! info
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
## Description
Most modern laptops have connected standby enabled which drains the battery, this sets hibernation as default which will not drain the battery. See issue https://github.com/ChrisTitusTech/winutil/issues/1399
<!-- BEGIN CUSTOM CONTENT -->
<!-- END CUSTOM CONTENT -->
<details>
<summary>Preview Code</summary>
```json
{
"Content": "Set Hibernation as default (good for laptops)",
"Description": "Most modern laptops have connected standby enabled which drains the battery, this sets hibernation as default which will not drain the battery. See issue https://github.com/ChrisTitusTech/winutil/issues/1399",
"category": "Essential Tweaks",
"panel": "1",
"Order": "a014_",
"registry": [
{
"Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Power\\PowerSettings\\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0",
"OriginalValue": "1",
"Name": "Attributes",
"Value": "2",
"Type": "DWord"
},
{
"Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Power\\PowerSettings\\abfc2519-3608-4c2a-94ea-171b0ed546ab\\94ac6d29-73ce-41a6-809f-6363ba21b47e",
"OriginalValue": "0",
"Name": "Attributes ",
"Value": "2",
"Type": "DWord"
}
],
"InvokeScript": [
"
Write-Host \"Turn on Hibernation\"
Start-Process -FilePath powercfg -ArgumentList \"/hibernate on\" -NoNewWindow -Wait
# Set hibernation as the default action
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 60\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 60\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-ac 10\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-dc 1\" -NoNewWindow -Wait
"
],
"UndoScript": [
"
Write-Host \"Turn off Hibernation\"
Start-Process -FilePath powercfg -ArgumentList \"/hibernate off\" -NoNewWindow -Wait
# Set standby to detault values
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 15\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 15\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-ac 15\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-dc 15\" -NoNewWindow -Wait
"
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/LaptopHibernation"
}
```
</details>
## Invoke Script
```powershell
Write-Host "Turn on Hibernation"
Start-Process -FilePath powercfg -ArgumentList "/hibernate on" -NoNewWindow -Wait
# Set hibernation as the default action
Start-Process -FilePath powercfg -ArgumentList "/change standby-timeout-ac 60" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList "/change standby-timeout-dc 60" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList "/change monitor-timeout-ac 10" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList "/change monitor-timeout-dc 1" -NoNewWindow -Wait
```
## Undo Script
```powershell
Write-Host "Turn off Hibernation"
Start-Process -FilePath powercfg -ArgumentList "/hibernate off" -NoNewWindow -Wait
# Set standby to detault values
Start-Process -FilePath powercfg -ArgumentList "/change standby-timeout-ac 15" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList "/change standby-timeout-dc 15" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList "/change monitor-timeout-ac 15" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList "/change monitor-timeout-dc 15" -NoNewWindow -Wait
```
## Registry Changes
Applications and System Components store and retrieve configuration data to modify windows settings, so we can use the registry to change many settings in one place.
You can find information about the registry on [Wikipedia](https://www.wikiwand.com/en/Windows_Registry) and [Microsoft's Website](https://learn.microsoft.com/en-us/windows/win32/sysinfo/registry).
### Registry Key: Attributes
**Type:** DWord
**Original Value:** 1
**New Value:** 2
### Registry Key: Attributes
**Type:** DWord
**Original Value:** 0
**New Value:** 2
<!-- BEGIN SECOND CUSTOM CONTENT -->
<!-- END SECOND CUSTOM CONTENT -->
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/tweaks.json)