Skip to content

fix: lock screen & explorer scripts#1666

Merged
RadNotRed merged 3 commits into
Atlas-OS:new-updatefrom
Stensel8:fix/lock-screen-ps1-migration
May 20, 2026
Merged

fix: lock screen & explorer scripts#1666
RadNotRed merged 3 commits into
Atlas-OS:new-updatefrom
Stensel8:fix/lock-screen-ps1-migration

Conversation

@Stensel8
Copy link
Copy Markdown
Contributor

@Stensel8 Stensel8 commented May 19, 2026

This replaces the lock screen and restart explorer .cmd scripts with proper PowerShell 5.1 equivalents. The .cmd scripts had a couple of bugs that caused the ERROR: Invalid syntax error 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 stateValue in the AtlasOS registry (it stored 1 instead of 0, which is what the Toolbox expects for a disabled lock screen). The Show script was calling reg delete with a /t REG_DWORD flag that the command does not accept, which is what caused the syntax error. The Hide script also had the /t and /v flags in the wrong order on its reg add call.

On top of fixing those bugs, the new scripts also handle NoChangingLockScreen alongside NoLockScreen. 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

@Stensel8 Stensel8 requested review from RadNotRed and Xyueta as code owners May 19, 2026 14:06
Copilot AI review requested due to automatic review settings May 19, 2026 14:06
@github-actions github-actions Bot added playbook Playbook related issues/PRs desktop folder AtlasDesktop folder related issues or PRs labels May 19, 2026
Stensel8 added 2 commits May 19, 2026 16:07
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
@Stensel8 Stensel8 force-pushed the fix/lock-screen-ps1-migration branch from a0a9262 to ac7fdb2 Compare May 19, 2026 14:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .cmd files with PowerShell 5.1 equivalents that self-elevate, set/clear both NoLockScreen and NoChangingLockScreen, and use proper registry cmdlets.
  • Teach DEFAULT.ps1 to invoke .ps1 services with -Silent (and keep /silent for .cmd services).
  • Adjust .gitattributes line-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.

Comment thread .gitattributes Outdated
Comment thread src/playbook/Executables/AtlasDesktop/4. Interface Tweaks/Restart Explorer.ps1 Outdated
Comment thread src/playbook/Executables/DEFAULT.ps1
@Stensel8
Copy link
Copy Markdown
Contributor Author

When disabling:

image image

And when enabling again:

image image

- 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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.

Stensel8 added a commit to Stensel8/atlas-toolbox that referenced this pull request May 19, 2026
…g missing registry value deletion

This fix ensures the toolbox is in sync with: Atlas-OS/Atlas#1666
@Stensel8 Stensel8 changed the title fix: migrate lock screen & restart explorer from .cmd to PowerShell 5.1 fix: lock screen & explorer scripts May 19, 2026
Copy link
Copy Markdown
Member

@RadNotRed RadNotRed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@RadNotRed RadNotRed merged commit 594a438 into Atlas-OS:new-update May 20, 2026
4 of 6 checks passed
@Stensel8 Stensel8 deleted the fix/lock-screen-ps1-migration branch May 20, 2026 21:59
@Stensel8 Stensel8 restored the fix/lock-screen-ps1-migration branch May 20, 2026 22:02
@Stensel8 Stensel8 deleted the fix/lock-screen-ps1-migration branch May 20, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop folder AtlasDesktop folder related issues or PRs playbook Playbook related issues/PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants