Skip to content

Commit 55264b3

Browse files
committed
fix: switch autostart from LaunchAgent to LoginItem (AppleScript)
MacosLauncher::LaunchAgent creates a hidden launchd plist invisible to the user. MacosLauncher::AppleScript registers via AppleScript/System Events, making PaperCache appear in System Settings > General > Login Items as a user-manageable entry.
1 parent 7a974c7 commit 55264b3

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

AUDIT_LOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
This log tracks all significant changes, updates, and versions in the PaperCache project.
44

5+
## 2026-06-25
6+
**Change:** fix: switch autostart from LaunchAgent to LoginItem (AppleScript)
7+
8+
**Details/Why:**
9+
The app was registered via `MacosLauncher::LaunchAgent`, creating a hidden `.plist` in `~/Library/LaunchAgents/` invisible to the user. Changed to `MacosLauncher::AppleScript`, which uses AppleScript to register via System Events — the app now appears in System Settings > General > Login Items as a user-manageable entry. The `--silently` flag and `hide_dock_icon()` still work as before.
10+
11+
**Files changed:** `src-tauri/src/lib.rs`, `CHANGELOG.md`.
12+
13+
---
14+
515
## 2026-06-25 - (Uncommitted)
616
**Change:** fix: window state persistence and login-item toggle desync (v0.5.4)
717

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111
- **Window position/size now persists across restarts**: The window-state plugin's `on_window_ready` fires before the macOS display server is ready, causing `available_monitors()` to return empty and the saved position to be silently discarded. Fixed by deferring window-state restoration via a background thread + `run_on_main_thread` 300ms after `setup()` completes, bypassing the plugin's monitor-intersection check with a direct file read. Both the tray "Quit" and Settings "Quit" buttons now explicitly save window state before exit.
12+
- **Launch at Startup now registers as a proper Login Item**: Changed `MacosLauncher` from `LaunchAgent` to `AppleScript`, which registers PaperCache in System Settings > General > Login Items instead of creating a hidden `launchd` plist. Users can now see and manage the autostart entry directly from System Settings.
1213
- **Login-item toggle stays in sync with macOS System Settings**: The launch-at-startup toggle only read from `localStorage`, so removing PaperCache from System Settings left the toggle permanently stuck in the checked state. Fixed by adding a `get_launch_at_startup` Tauri command that queries the actual OS login-item state via `app.autolaunch().is_enabled()`, and syncing the toggle with the real OS state on every Settings mount.
1314

1415
## [v0.5.3] - 2026-06-24

src-tauri/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn run() {
4545
)
4646
.plugin(tauri_plugin_global_shortcut::Builder::default().build())
4747
.plugin(tauri_plugin_autostart::init(
48-
tauri_plugin_autostart::MacosLauncher::LaunchAgent,
48+
tauri_plugin_autostart::MacosLauncher::AppleScript,
4949
Some(vec!["--silently"]),
5050
))
5151
.plugin(tauri_plugin_updater::Builder::new().build())

0 commit comments

Comments
 (0)