Add launch-at-login via tauri-plugin-autostart#22
Conversation
- Register autostart plugin (LaunchAgent on macOS, HKCU Run key on Windows) and grant autostart:default in the desktop capability - Add a Launch at Login toggle to the settings sheet that reads the OS state on open and applies enable/disable on save - Add an integration test that round-trips enable/disable and asserts the Windows Run registry entry is created and removed - Embed the Common Controls v6 manifest into test binaries so cargo test does not crash with STATUS_ENTRYPOINT_NOT_FOUND on Windows (tauri-apps/tauri discussion #11179) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Claude finished @cohogan's task in 1m 46s —— View job Code Review: Add launch-at-login via tauri-plugin-autostart
Overall this is a clean, well-structured PR that follows the existing patterns in the codebase. The plugin wiring, capability grant, test, and UI toggle are all done correctly. A few observations below. Findings1. Partial save if autostart toggle fails —
A simple fix would be to swap the order (autostart first, then upload config) or to handle the autostart error independently: // Option A: independent error handling
try {
if (launchAtLogin) await enableAutostart();
else await disableAutostart();
} catch (err) {
console.error("Failed to toggle autostart:", err);
toast.error("Failed to update launch-at-login setting");
}2. Unconditional enable/disable on every save —
3. Missing trailing newline — The diff shows 4. Test cleanup on panic — If the test panics between What looks good
Verdict: Looks good to merge. Finding #1 (partial save) is the only one I'd consider addressing before merge, but it's low-risk given that autostart calls rarely fail and a retry resolves it. |
Summary
LaunchAgenton macOS,HKCU\...\Runkey on Windows,.desktopentry on Linux) withautostart:defaultgranted in the desktop capabilitysrc-tauri/tests/autostart.rs, the first Rust integration test in the repo: round-tripsenable()/disable()and independently asserts the Windows Run registry entry is created and removedbuild.rs: embeds the Common Controls v6 manifest into test binaries only socargo testdoes not crash withSTATUS_ENTRYPOINT_NOT_FOUNDon Windows (known issue, see tauri-apps discussion #11179); the app build is unchangedTesting
cargo test --test autostartpasses: enable →is_enabled()true andreg queryshows the Run entry → disable → entry goneplugin:autostart|enable/is_enabled/disableall succeed from the main window, andHKCU\Software\Microsoft\Windows\CurrentVersion\Rungained/lost theLabric Syncentry accordingly — confirming plugin registration and capability permissions end to endcargo clippyclean,pnpm build(tsc + vite) passesNotes
--minimizedlaunch arg and start hidden in the tray when launched at login🤖 Generated with Claude Code