diff --git a/README.md b/README.md index a459862..3bab0c4 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,10 @@ The files are saved under `Documents\ConfigCentral\captures\MACHINE-yyyyMMdd-HHmmss`. Review them, copy the desired settings into this repository, then commit and push. Run the update command on the other computers to receive those changes. +This includes Windows sound-event settings and the active power plan's battery +screen timeout. The repository defaults disable system sounds and keep the +screen on while on battery. + Capture does not upload anything automatically; some exports need curation. See the [application config guide](docs/desktop-app-configs.md) for details. diff --git a/TASKS.md b/TASKS.md index cd1dc32..7076914 100644 --- a/TASKS.md +++ b/TASKS.md @@ -147,4 +147,4 @@ open until it is run on disposable machines with the required account setups. - [x] Back up registry value types and presence; restore failed writes or the full managed declaration on operation failure, and report incomplete rollback; verified with mocked rollback and state-failure tests. - [x] Add capture/apply adapters for Windows sound-event assignments and the active plan's battery display timeout, with constrained declarations, backups, drift detection, and rollback; validate with Linux mocks. -- [ ] Enable the Windows sound/power defaults in desktop profiles and document the capture/update workflow. +- [x] Enable the Windows sound/power defaults in desktop profiles and document the capture/update workflow. diff --git a/docs/desktop-app-configs.md b/docs/desktop-app-configs.md index f7c57f4..bfe89d5 100644 --- a/docs/desktop-app-configs.md +++ b/docs/desktop-app-configs.md @@ -6,8 +6,8 @@ configuration is also managed when Ontime is installed separately. Close an application before applying its config so it does not immediately overwrite the result. -The checked-in declarations start as safe no-ops or comment-only files. Populate -only the values you want shared across every selected machine. +Review the checked-in declarations before sharing them across machines; they +include application preferences and Windows defaults. Run `cc capture` to collect the current machine's configuration without applying repository content. Captures are written beneath @@ -168,3 +168,49 @@ command, which still does not support registry backups. Inspect and commit each source file separately so no history, credentials, tokens, or machine-specific paths enter Git. + +## Windows sounds and battery display timeout + +The `desktop-apps` profile includes `windows-sounds` and `windows-power`. +They participate in normal setup, config-only updates, conflict detection, +backups, and `cc capture`. Capture just these settings with: + +```powershell +cc capture -Config windows-sounds +cc capture -Config windows-power +``` + +Each capture writes under Documents, with repository-relative +`configs/windows/sounds.json` or `configs/windows/power.json`. Review and copy +these files into the repository, commit and push, then run the usual config +update on each computer. Capture never changes the live settings. + +**Sounds:** the checked-in `{"schemaVersion":1,"disabled":true}` preset clears +all registered current sound-event assignments for the desktop user and selects +“No Sounds”. It applies to events present on each receiving machine, including +events absent on the capture machine. If capture finds any assigned sounds, it +instead exports current event assignments and the selected scheme. Review +custom WAV paths before sharing; WAV files themselves are not copied. +This controls the user's Windows sound scheme, not master volume, audio devices, +the separate startup-sound setting, or applications that play their own audio. +Windows stores these assignments under +[AppEvents sound-event registry keys](https://devblogs.microsoft.com/scripting/hey-scripting-guy-how-can-i-randomly-assign-a-sound-to-a-sound-event/). +Close the Sound control panel before updating; applications that cache sounds +may need restarting. + +**Power:** `batteryDisplayTimeoutSeconds` sets only the active plan's display +idle timeout on battery; `0` means never, as specified in +[Microsoft's display idle timeout documentation](https://learn.microsoft.com/en-us/windows-hardware/customize/power-settings/display-settings-display-idle-timeout). +Capture saves seconds, not a machine-specific plan GUID. Apply targets the +receiving machine's active plan. AC timeouts, sleep, hibernation, lid actions, +and lock-screen display timeout are unchanged; sleep can still switch off the +display. Switching plans later can select a different timeout, so rerun the +update after switching if needed. A managed Windows policy may block writes; +the result reports that failure instead of bypassing policy. + +Before applying, both adapters save backups under Config Central's backup +directory. Any sound-write failure restores the managed sound assignments; +power failures restore the previous timeout on the original plan. Restoration +errors retain the backup and are reported explicitly. These adapters run as the +desktop user and never redirect sound settings into an administrator profile. +Manual `cc restore` remains limited to file configs. diff --git a/profiles/desktop-apps.json b/profiles/desktop-apps.json index e72b0e4..861cc8d 100644 --- a/profiles/desktop-apps.json +++ b/profiles/desktop-apps.json @@ -49,6 +49,18 @@ "source": "configs/windows/hosts.entries", "target": "%SYSTEMROOT%/System32/drivers/etc/hosts", "mode": "hosts-block" + }, + { + "name": "windows-sounds", + "source": "configs/windows/sounds.json", + "target": "HKCU:\\AppEvents\\Schemes", + "mode": "windows-sounds" + }, + { + "name": "windows-power", + "source": "configs/windows/power.json", + "target": "active-power-scheme", + "mode": "windows-power" } ] } diff --git a/tests/Manifest.Tests.ps1 b/tests/Manifest.Tests.ps1 index 0494afe..6d32a98 100644 --- a/tests/Manifest.Tests.ps1 +++ b/tests/Manifest.Tests.ps1 @@ -6,7 +6,7 @@ Describe 'Manifest resolution' { It 'resolves the checked-in example in profile order' { $result = Resolve-MachineManifest -RepositoryRoot "$PSScriptRoot/.." -Machine 'beffroi-laptop' $result.packages.Count | Should -Be 14 - $result.configs.Count | Should -Be 7 + $result.configs.Count | Should -Be 9 $result.packages[0].id | Should -Be 'Git.Git' $result.packages.id | Should -Contain 'XnSoft.XnViewMP' $result.packages.id | Should -Contain 'Zoom.Zoom'