fix: lock screen & explorer scripts#1666
Conversation
Replace legacy .cmd scripts with modern PowerShell 5.1 equivalents: - Hide/Show Lock Screen: fix stateValue bug (both had wrong values), add NoChangingLockScreen handling to prevent greyed-out Settings, self-elevating admin check, try/catch error handling - Restart Explorer: simplify to Stop-Process only; Windows auto-restarts the shell, avoiding the spurious File Explorer window the old script caused - DEFAULT.ps1: invoke .ps1 scripts with -Silent instead of /silent - DEFAULT.reg: update LockScreen path from .cmd to .ps1 - .gitattributes: change ps1/psm1/bat/cmd from eol=crlf to eol=lf Closes Atlas-OS#1664
a0a9262 to
ac7fdb2
Compare
There was a problem hiding this comment.
Pull request overview
Migrates the lock-screen toggle scripts and the "Restart Explorer" helper from .cmd to PowerShell 5.1, fixing the syntax error reported in #1664 (caused by /t REG_DWORD being passed to reg delete) and the related "managed by your organization" greying-out of Settings (root-caused to a missing NoChangingLockScreen value). DEFAULT.ps1 is taught to dispatch .ps1 services with -Silent while still passing /silent to legacy .cmd services. The PR also flips line-ending normalization for *.ps1/*.psm1/*.bat/*.cmd from CRLF to LF and adds a .claude/ ignore entry.
Changes:
- Replace lock-screen and restart-explorer
.cmdfiles with PowerShell 5.1 equivalents that self-elevate, set/clear bothNoLockScreenandNoChangingLockScreen, and use proper registry cmdlets. - Teach
DEFAULT.ps1to invoke.ps1services with-Silent(and keep/silentfor.cmdservices). - Adjust
.gitattributesline-ending normalization and add.claude/to.gitignore.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/playbook/Executables/AtlasDesktop/4. Interface Tweaks/Lock Screen/Hide Lock Screen.ps1 |
New PS replacement that self-elevates and sets both lock-screen policy values. |
src/playbook/Executables/AtlasDesktop/4. Interface Tweaks/Lock Screen/Hide Lock Screen.cmd |
Old buggy .cmd removed. |
src/playbook/Executables/AtlasDesktop/4. Interface Tweaks/Lock Screen/Show Lock Screen (default).ps1 |
New PS replacement that removes both lock-screen policy values; fixes #1664 syntax error. |
src/playbook/Executables/AtlasDesktop/4. Interface Tweaks/Lock Screen/Show Lock Screen (default).cmd |
Old buggy .cmd removed. |
src/playbook/Executables/AtlasDesktop/4. Interface Tweaks/Restart Explorer.ps1 |
New PS version that only stops explorer.exe and relies on Windows to relaunch the shell. |
src/playbook/Executables/AtlasDesktop/4. Interface Tweaks/Restart Explorer.cmd |
Old .cmd (which spawned a stray Explorer window) removed. |
src/playbook/Executables/DEFAULT.ps1 |
Dispatches .ps1 services with -Silent, falls back to /silent for .cmd. |
.gitattributes |
Switches *.ps1/*.psm1/*.bat/*.cmd normalization from CRLF to LF. |
.gitignore |
Adds .claude/ directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Revert bat/cmd line endings back to eol=crlf; changing these is out of scope and risky for existing cmd.exe scripts in the repo - Simplify Restart Explorer.ps1: remove try/catch that was dead code due to -ErrorAction SilentlyContinue suppressing errors before catch could fire
…g missing registry value deletion This fix ensures the toolbox is in sync with: Atlas-OS/Atlas#1666




This replaces the lock screen and restart explorer
.cmdscripts with proper PowerShell 5.1 equivalents. The.cmdscripts had a couple of bugs that caused theERROR: Invalid syntaxerror reported in #1664, and they were also missing some registry cleanup that left Settings greyed out with "managed by your organization" even after re-enabling the lock screen.The Hide script was setting the wrong
stateValuein the AtlasOS registry (it stored1instead of0, which is what the Toolbox expects for a disabled lock screen). The Show script was callingreg deletewith a/t REG_DWORDflag that the command does not accept, which is what caused the syntax error. The Hide script also had the/tand/vflags in the wrong order on itsreg addcall.On top of fixing those bugs, the new scripts also handle
NoChangingLockScreenalongsideNoLockScreen. Without removing that value, the lock screen settings stay greyed out in the Settings app after running the Show script, which is what was happening to users.Restart Explorer was also migrated. The old script restarted Explorer manually after killing it, which caused a File Explorer window to pop up. The new version just stops the process and lets Windows restart the shell on its own.
All scripts have been tested locally on my laptop and work as expected.
Closes #1664