Menu ▾ ▴

#443 Start on System Startup: show the real OS state, and use a login item on macOS

open
nobody
6 days ago
6 days ago
Anonymous
No

Originally created by: kristofferR

Problem

Start on System Startup only ever writes the setting. settings::sync_autostart calls enable() or disable() on tauri-plugin-autostart and never checks the result against the OS afterwards. Every platform lets the user turn startup off outside Chatpane, and Chatpane's setting then stays on while Chatpane doesn't start:

  • Windows: Task Manager's Startup tab and Settings → Apps → Startup leave the HKCU\Software\Microsoft\Windows\CurrentVersion\Run value in place and record the disable under HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run, which Chatpane never reads.
  • Linux: the user, GNOME Tweaks or KDE's Autostart settings can delete ~/.config/autostart/*.desktop or set Hidden=true in it.
  • macOS: the plugin uses MacosLauncher::LaunchAgent (lib.rs), a plist in ~/Library/LaunchAgents. On macOS 13+ it shows in System Settings → General → Login Items under "Allow in the Background", without being clearly tied to Chatpane, instead of as an "Open at Login" app, and can be switched off there.

Goal

Chatpane's setting shows whether Chatpane will really start at login, on every platform. On macOS 13+, Chatpane is a normal "Open at Login" item.

Scope

  • Read the real state when the app starts and when Settings opens, and show it:
  • Windows: the Run value exists and its StartupApproved\Run entry, if any, isn't marked disabled. If the user disabled it in Task Manager, turning it back on in Chatpane also clears that disable, or the setting says to use Task Manager. Decide which while implementing.
  • Linux: the autostart file exists, isn't Hidden=true, and launches this install.
  • macOS 13+: SMAppService.mainApp.status, including requiresApproval with a button that opens Login Items (SMAppService.openSystemSettingsLoginItems).
  • macOS 13+: register and unregister through SMAppService.mainApp (objc2 ServiceManagement). When switching, remove the old LaunchAgent plist so Chatpane doesn't launch twice. macOS 10.15 to 12 keeps the LaunchAgent.
  • Snap keeps its current "unavailable" message.

Verification

  • On each platform: turn it on in Chatpane, log out and back in, and Chatpane starts once. Turn it off with the OS's own setting, and Chatpane's setting shows off. Turn it back on in Chatpane, and it starts again.
  • macOS: upgrading from a build with the LaunchAgent leaves no plist behind and doesn't double-launch. Check on a release-signed build. Ad-hoc debug builds may not register.

Related

Tickets: #450

Discussion


Log in to post a comment.