|
| 1 | +# Turn Off Screen on Lock |
| 2 | + |
| 3 | +**Lock your PC, screen goes dark in 5 seconds. Come back, and you actually have time to type your password.** |
| 4 | + |
| 5 | + |
| 6 | +## The problem |
| 7 | + |
| 8 | +Let's say that you want your screen to go dark 5 seconds after Windows is locked. |
| 9 | +There is only one setting (`VIDEOCONLOCK`) that controls this on both occasions: |
| 10 | + |
| 11 | +1. **After you lock**: you want it short, like 5 seconds, so the screen goes dark quickly |
| 12 | +2. **When you want to unlock**: that same 5 seconds is all you get to start typing your password before the screen goes dark again |
| 13 | + |
| 14 | +This can especially useful, if you are using a docking station, which often takes several seconds (up to 10-15) for the whole system to "wake up". |
| 15 | + |
| 16 | + |
| 17 | +## What this does |
| 18 | + |
| 19 | +Flips `VIDEOCONLOCK` between a short and long value at the right time: |
| 20 | + |
| 21 | +| When | Timeout | |
| 22 | +|---|---| |
| 23 | +| You lock the PC | **5 seconds** (screen off fast) | |
| 24 | +| You wake it to unlock | changed to **5 minutes** (enough time to start typing your password) | |
| 25 | +| You unlock | Back to **5 seconds** for next time | |
| 26 | + |
| 27 | +Both values are [configurable](#configuration). |
| 28 | + |
| 29 | +Under the hood it's three scheduled tasks and a PowerShell script that rewrite the setting on lock, wake, and unlock events. Nothing stays running in the background. |
| 30 | + |
| 31 | + |
| 32 | +## Requirements |
| 33 | + |
| 34 | +- Windows 10 or 11 with Modern Standby (S0 Low Power Idle) |
| 35 | +- PowerShell 5.1+ |
| 36 | +- Admin privileges (one-time, for install) |
| 37 | + |
| 38 | + |
| 39 | +## Install |
| 40 | + |
| 41 | +1. Open PowerShell as Admin |
| 42 | +2. `cd` to where you want the files to live (they stay there): |
| 43 | + |
| 44 | +```powershell |
| 45 | +cd <your-folder> |
| 46 | +``` |
| 47 | + |
| 48 | +3. Download and install the latest release: |
| 49 | + |
| 50 | +```powershell |
| 51 | +irm https://github.com/michaliskon/Turn-off-screen-on-lock/releases/latest/download/install.ps1 | iex |
| 52 | +``` |
| 53 | + |
| 54 | +The script verifies the download checksum before running. |
| 55 | + |
| 56 | +<details> |
| 57 | +<summary>Manual installation (inspect before running)</summary> |
| 58 | + |
| 59 | +If you prefer to review the bootstrap script before execution: |
| 60 | + |
| 61 | +```powershell |
| 62 | +Invoke-WebRequest https://github.com/michaliskon/Turn-off-screen-on-lock/releases/latest/download/install.ps1 -OutFile install.ps1 |
| 63 | +Get-Content install.ps1 |
| 64 | +``` |
| 65 | +Then: |
| 66 | +``` |
| 67 | +.\install.ps1 |
| 68 | +``` |
| 69 | + |
| 70 | +</details> |
| 71 | + |
| 72 | + |
| 73 | +## Configuration |
| 74 | + |
| 75 | +Defaults: |
| 76 | +- **5 seconds** after lock |
| 77 | +- **5 minutes** on wake |
| 78 | + |
| 79 | +Can be adjusted by editing the config file: |
| 80 | + |
| 81 | +``` |
| 82 | +%LOCALAPPDATA%\Turn-off-screen-on-lock\config.json |
| 83 | +``` |
| 84 | + |
| 85 | +```json |
| 86 | +{ |
| 87 | + "baselineTimeoutSeconds": 1, |
| 88 | + "wakeTimeoutSeconds": 300 |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +| Setting | Default | Description | |
| 93 | +|---|---|---| |
| 94 | +| `baselineTimeoutSeconds` | 1 | Seconds before the screen turns off after locking | |
| 95 | +| `wakeTimeoutSeconds` | 300 | Seconds the screen stays on when waking to unlock | |
| 96 | + |
| 97 | +Both values must be integers between 1 and 86400 (24 hours). |
| 98 | + |
| 99 | +The config file is created automatically during installation. Changes take effect on the next lock, unlock, or wake event -- no reinstall needed. |
| 100 | + |
| 101 | + |
| 102 | +## Uninstall |
| 103 | +In case you want to uninstall: |
| 104 | + |
| 105 | +1. Open PowerShell as Administrator |
| 106 | +2. Run: |
| 107 | + |
| 108 | +```powershell |
| 109 | +& "$env:TURN_OFF_SCREEN_ON_LOCK_UNINSTALL" |
| 110 | +``` |
| 111 | + |
| 112 | +3. Once the uninstaller confirms success, you can delete the install folder. |
| 113 | + |
| 114 | + |
| 115 | +## Security Review |
| 116 | + |
| 117 | +The security and reliability profiles chosen for this project are targeting personal use on trusted home machines. |
| 118 | + |
| 119 | +Enterprise and public device usage have been included in the security review, which concluded that additional hardening is strongly recommended in such cases - see [threat-model-v1.0.0.md](threat-model-v1.0.0.md) for the related risks. |
| 120 | + |
| 121 | + |
| 122 | +## Documentation |
| 123 | + |
| 124 | +See [spec.md](spec.md) for the full design specification. |
| 125 | + |
| 126 | + |
| 127 | +## Human / AI 🤖 Contribution in this Project |
| 128 | + |
| 129 | +Based on the project complexity and criticality, human oversight was kept to *low/medium* effort. |
| 130 | +||| |
| 131 | +|:---|:---:| |
| 132 | +| Complexity | Low | |
| 133 | +| Criticality | Low | |
| 134 | +||| |
| 135 | + |
| 136 | + |
| 137 | +### Activity split |
| 138 | + |
| 139 | +| Activity | Human | AI | |
| 140 | +|:---|:---:|:---:| |
| 141 | +| Use case development | ✔️ | ❌ | |
| 142 | +| Design | ❌ | ✔️ | |
| 143 | +| Design review | ✔️ | ❌ | |
| 144 | +| Coding | ❌ | ✔️ | |
| 145 | +| Code review | ❌ | ✔️ | |
| 146 | +| Functional testing | ✔️ | ❌ | |
| 147 | +| Security analysis | ❌ | ✔️ | |
| 148 | +| Security risk review | ✔️ | ❌ | |
| 149 | +| Security risk remediation | ❌ | ✔️ | |
| 150 | +| Deployment | ✔️ | ✔️ | |
| 151 | + |
| 152 | +### LLMs used |
| 153 | +| Phase | LLM/coding assistant | |
| 154 | +|---|---| |
| 155 | +| PoC and initial development | ChatGPT | |
| 156 | +| Maturing and release | Claude Code | |
| 157 | +| Continuous security reviews and hardening | Claude Code | |
| 158 | +| Final security reviews (release) | Claude Code, Codex, Gemini | |
| 159 | + |
| 160 | + |
| 161 | + |
| 162 | +## Contributing |
| 163 | + |
| 164 | +### Bugs |
| 165 | +Bug reports are welcome - please open an [issue](https://github.com/michaliskon/Turn-off-screen-on-lock/issues) first using the "Bug report" template. |
| 166 | +No unsolicited PRs. |
| 167 | + |
| 168 | +### Security Vulnerabilities |
| 169 | +Report security vulnerabilities in [GitHub Security Advisories](https://github.com/michaliskon/Turn-off-screen-on-lock/security/advisories/new) - see also [SECURITY.md](SECURITY.md) |
| 170 | +- Security hardening for home use will be supported, provided the vulnerability can be demonstrated sufficiently. |
| 171 | +- Security hardening relevant only for enterprise use will be supported, if there is enough community interest. |
| 172 | +- Critical or high criticality vulnerabilities will always be investigated and responded to (and if possible remediated), regardless of usage or interest. |
| 173 | + |
| 174 | +### Features |
| 175 | +All feature requests are welcome - please open an [issue](https://github.com/michaliskon/Turn-off-screen-on-lock/issues) using the "Feature request" template. |
| 176 | +- Feature requests for home use will be supported, considering a real use case can be exhibited. |
| 177 | +- Feature requests for enterprise use will be supported, if there is enough community interest. |
| 178 | + |
| 179 | + |
| 180 | + |
| 181 | +## License |
| 182 | + |
| 183 | +[MIT](LICENSE) |
0 commit comments