Repository navigation
Conversation
The Settings handlers only offer power timeouts and button actions as
translated display labels ("15 minutes (Recommended)"), which would break a
config on any non-English Windows. Power rows in the settings catalog instead
name a power setting by subgroup and setting GUID, AC or DC, and a scale, and
src/settings_power.c reads and writes them on the active scheme through
PowerRead/WriteAC/DCValueIndex, re-applying the scheme after a write.
power.setup takes screen_off, sleep and hibernate in minutes (0 never) and
power_button, sleep_button and lid actions, each with a _battery twin. The
same fields work from mshell.exe --settings and are applied in the background
on start and reload like the other Windows settings; a value that is not a
whole minute reads back in seconds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
screen_off,sleep,hibernate: minutes idle, 0 = never, 0–1440.power_button,sleep_button:nothing | sleep | hibernate | shutdown | display_off.lid: the same withoutdisplay_off._batterytwin for the DC value.Why not the Settings handlers
They offer these only as translated display labels (
"15 minutes (Recommended)","Do Nothing"), so a config would break on a non-English Windows. Power rows in the catalog instead carry the power subgroup and setting GUIDs, AC or DC, and a scale;src/settings_power.creads and writes them on the active scheme withPowerRead/WriteAC/DCValueIndexand re-applies the scheme. Everything else — Lua validation,--settings, background apply on start and reload, failure notification — is the existing settings machinery.Values belong to the active plan, so switching plans brings that plan's own values until the next reload writes them again.
Tested
make allwith no warnings,make test,make test-asan,make meta(committed), README Lua blocks viacheck-configsettings_catalogsuite (2173 assertions): power rows have braced GUIDs, numeric option indices, unique setting/AC-DC pairs; engine text and read-back words for timeouts and actionspowercfg /qh;screen_off3 → 4 → 3 changed only the AC index (180 → 240 → 180 s);sleep_button_batterysleep → hibernate → sleep changed only the DC index;lid = display_offrejected; a 90 s plan value reads as90 secondsand setting3writes 180