Skip to content

Commit a7fbbb3

Browse files
Copilotmichaliskon
andauthored
fix: restore DefaultBaseline from 1 to 5 (regression from history rewrite)
Agent-Logs-Url: https://github.com/michaliskon/Turn-off-screen-on-lock/sessions/1a165efb-b47f-451c-96fd-9ec2ffb4e215 Co-authored-by: michaliskon <49875310+michaliskon@users.noreply.github.com>
1 parent c321ed1 commit a7fbbb3

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ Can be adjusted by editing the config file:
8484

8585
```json
8686
{
87-
"baselineTimeoutSeconds": 1,
87+
"baselineTimeoutSeconds": 5,
8888
"wakeTimeoutSeconds": 300
8989
}
9090
```
9191

9292
| Setting | Default | Description |
9393
|---|---|---|
94-
| `baselineTimeoutSeconds` | 1 | Seconds before the screen turns off after locking |
94+
| `baselineTimeoutSeconds` | 5 | Seconds before the screen turns off after locking |
9595
| `wakeTimeoutSeconds` | 300 | Seconds the screen stays on when waking to unlock |
9696

9797
Both values must be integers between 1 and 86400 (24 hours).

spec.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In practice, it gives you both of these behaviors at the same time:
1515
The solution uses `VIDEOCONLOCK`, a controller, three runtime files, and three Scheduled Tasks.
1616

1717
Runtime logic:
18-
- unlocked: `VIDEOCONLOCK` = baseline timeout (default 1 second, configurable)
18+
- unlocked: `VIDEOCONLOCK` = baseline timeout (default 5 seconds, configurable)
1919
- locked + system enters Modern Standby: On Wake task asks the controller to promote `VIDEOCONLOCK` to wake timeout (default 300 seconds, configurable)
2020
- unlocked again: controller resets `VIDEOCONLOCK` to baseline timeout
2121

@@ -30,7 +30,7 @@ Roles:
3030

3131
## Intended behavior
3232

33-
- Unlocked: `VIDEOCONLOCK` = baseline timeout (default 1 second, configurable via `config.json`)
33+
- Unlocked: `VIDEOCONLOCK` = baseline timeout (default 5 seconds, configurable via `config.json`)
3434
- Locked + exiting Modern Standby: `VIDEOCONLOCK` promoted to wake timeout (default 300 seconds, configurable via `config.json`)
3535
- Unlocked again: `VIDEOCONLOCK` reset to baseline for the next cycle
3636

@@ -138,7 +138,7 @@ Full runtime design, one complete lock/unlock cycle.
138138

139139
### 1. PC is unlocked
140140

141-
- `VIDEOCONLOCK` AC and DC: baseline timeout (default `1`)
141+
- `VIDEOCONLOCK` AC and DC: baseline timeout (default `5`)
142142
- `state.json`: `status = "unlocked"`, `generation = <latest>`, `lastActionUtc = <timestamp>`
143143

144144
The baseline is armed for the next lock event.
@@ -161,7 +161,7 @@ wscript.exe "<install-folder>\RunHidden.vbs" OnLock
161161

162162
### 4. Display turns off
163163

164-
`VIDEOCONLOCK` is still at the baseline (default 1 second), so Windows turns the display off shortly after lock.
164+
`VIDEOCONLOCK` is still at the baseline (default 5 seconds), so Windows turns the display off shortly after lock.
165165

166166
### 5. System enters Modern Standby
167167

@@ -400,7 +400,7 @@ It bridges the gap between the GitHub Release and `installer.ps1`.
400400
Parse the hex values after "Current AC Power Setting Index" and "Current DC Power Setting Index", convert to decimal, and write `baseline.json`. If a valid `baseline.json` already exists, preserve it so the true originals are never lost on re-install.
401401

402402
7. **Create or preserve `config.json`**
403-
If missing or malformed, create with defaults (`baselineTimeoutSeconds = 1`, `wakeTimeoutSeconds = 300`). If valid, preserve it. Read the effective baseline timeout for the next step.
403+
If missing or malformed, create with defaults (`baselineTimeoutSeconds = 5`, `wakeTimeoutSeconds = 300`). If valid, preserve it. Read the effective baseline timeout for the next step.
404404

405405
8. **Apply the baseline `VIDEOCONLOCK` setting**
406406
Log the applied value. If the value came from an existing `config.json`, indicate that in the message.
@@ -577,14 +577,14 @@ The controller reads `%LOCALAPPDATA%\Turn-off-screen-on-lock\config.json` on eac
577577

578578
```json
579579
{
580-
"baselineTimeoutSeconds": 1,
580+
"baselineTimeoutSeconds": 5,
581581
"wakeTimeoutSeconds": 300
582582
}
583583
```
584584

585585
| Field | Type | Range | Default | Description |
586586
|---|---|---|---|---|
587-
| `baselineTimeoutSeconds` | integer | 1–86400 | 1 | Seconds before the screen turns off after locking. Also the value restored on unlock. |
587+
| `baselineTimeoutSeconds` | integer | 1–86400 | 5 | Seconds before the screen turns off after locking. Also the value restored on unlock. |
588588
| `wakeTimeoutSeconds` | integer | 1–86400 | 300 | Seconds the screen stays on when waking from Modern Standby to unlock. |
589589

590590
Loading rules:
@@ -605,7 +605,7 @@ Loading rules:
605605
powercfg /q SCHEME_CURRENT SUB_VIDEO VIDEOCONLOCK | findstr /i "Current AC Current DC"
606606
```
607607

608-
- Unlocked: baseline (default `0x00000001` = 1 second).
608+
- Unlocked: baseline (default `0x00000005` = 5 seconds).
609609
- After promotion during a locked cycle: wake timeout (default `0x0000012c` = 300 seconds).
610610

611611
### Check the tasks

src/LockTimeoutController.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function Get-State {
3737
}
3838

3939
function Get-Config {
40-
$DefaultBaseline = 1
40+
$DefaultBaseline = 5
4141
$DefaultWake = 300
4242
$ConfigPath = Join-Path $DataDir 'config.json'
4343

src/installer.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ try {
298298
$baseline | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $BaselinePath -Encoding UTF8
299299
}
300300

301-
$DefaultBaseline = 1
301+
$DefaultBaseline = 5
302302
$DefaultWake = 300
303303

304304
$ConfigPath = Join-Path $DataDir 'config.json'

0 commit comments

Comments
 (0)