Skip to content

fix(autostart): use CurrentUser registry and normalise Scoop path on Windows#133

Merged
StudentWeis merged 3 commits into
mainfrom
fix/windows-autostart-132
May 14, 2026
Merged

fix(autostart): use CurrentUser registry and normalise Scoop path on Windows#133
StudentWeis merged 3 commits into
mainfrom
fix/windows-autostart-132

Conversation

@StudentWeis
Copy link
Copy Markdown
Owner

Summary

  • Use WindowsEnableMode::CurrentUser (HKCU) instead of Dynamic mode to avoid silent failures on non-admin accounts or systems with restrictive security policies.
  • Normalise Scoop installation paths from versioned directories (apps\ropy\0.5.1\) to the stable apps\ropy\current\ junction so the registry entry survives scoop update.

Closes #132

Notes on the console flash issue

The brief terminal window flash reported in the issue is caused by Scoop's shim mechanism — scoop\shims\ropy.exe is a console-subsystem proxy that launches the real GUI binary. This is a Scoop-side limitation that cannot be fixed in application code (the app already sets windows_subsystem = "windows"). Users can work around it by launching directly from the apps\ropy\current\ropy.exe path or by upgrading Scoop which has improved shimgen for GUI apps.

Test plan

  • On Windows 11, install via Scoop, toggle auto-start in Settings, verify registry entry at HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run points to …\current\ropy.exe
  • Reboot and confirm Ropy starts automatically
  • Run scoop update ropy, reboot, and confirm auto-start still works
  • On macOS/Linux, verify no behavioral change (cargo test passes, auto-start still works)

…Windows

On Windows the auto-launch builder now explicitly targets HKCU instead
of the default Dynamic mode (try HKLM, fall back to HKCU) which can
silently fail on non-admin accounts or be blocked by security policies.

Additionally, when running from a Scoop installation the resolved exe
path (e.g. `…\apps\ropy\0.5.1\ropy.exe`) is normalised back to the
stable `…\apps\ropy\current\ropy.exe` junction so that the registry
entry survives package upgrades.

Closes #132
Move the inline Scoop versioned-path rewrite out of `get_app_path` into
a standalone `normalise_scoop_path` helper, and cover it with pure
string-level unit tests (versioned segment, `current` junction, case
variations, non-Scoop paths, malformed inputs).

Also drop the `to_lowercase()` allocation in favour of
`eq_ignore_ascii_case` on raw bytes, since the marker is pure ASCII.

Refs #132
@StudentWeis StudentWeis merged commit 3e7606c into main May 14, 2026
8 checks passed
@StudentWeis StudentWeis deleted the fix/windows-autostart-132 branch May 14, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

开机自启不生效

1 participant