Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions desktop/src-tauri/src/first_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ pub fn apply_start_at_login_default(app: &AppHandle) -> StartAtLogin {
/// It runs once, behind its own marker, and only where autostart is already on. It never turns the
/// setting on and never turns it off; the worst case is an entry that keeps its old arguments and a
/// login launch that shows its window, which is the visible failure rather than the silent one.
///
/// On macOS the marker lives in a config directory every copy of the app shares, while the plugin
/// rewrites whatever plist exists. The rewrite is therefore limited to this copy's own entry in the
/// exact shape the plugin writes; another or a missing copy, or any key the rewrite would drop, is
/// left untouched and unmarked (#6972).
pub fn adopt_launch_origin_argument(app: &AppHandle) {
let Ok(dir) = app.path().app_config_dir() else {
return;
Expand All @@ -102,6 +107,23 @@ pub fn adopt_launch_origin_argument(app: &AppHandle) {
// that is already enabled, so retrying after a transient registry, LaunchAgent or desktop-file
// error is free — and claiming the marker first would suppress the migration permanently and
// leave a login launch showing its window forever.
#[cfg(target_os = "macos")]
{
use crate::login_registration::Migration;
let Ok(home) = app.path().home_dir() else {
return;
};
match crate::login_registration::judge_migration(&home) {
Migration::Rewrite => {
if crate::login_autostart::enable(app).is_err() {
return;
}
}
Migration::Absent => {}
Migration::Leave => return,
}
}
#[cfg(not(target_os = "macos"))]
match app.autolaunch().is_enabled() {
Ok(true) => {
if crate::login_autostart::enable(app).is_err() {
Expand Down
5 changes: 5 additions & 0 deletions desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ mod formatting;
mod identity;
mod logging;
mod login_autostart;
// The judgment is portable so Linux CI runs its fixture parity tests; only macOS reads launchd.
#[cfg(any(target_os = "macos", test))]
mod login_registration;
#[cfg(any(target_os = "windows", test))]
mod windows_autostart_command;
// macOS only: it exists to replace one item in a menu no other platform installs. Compiling it
Expand All @@ -35,6 +38,8 @@ mod popup;
mod popup;
#[cfg(target_os = "macos")]
mod provider_icons;
#[cfg(target_os = "macos")]
mod tray_login;
// The macOS build selects native_tray.rs as the popup module; compile the portable popup
// module's tests on macOS too so its navigation rules run on the maintainers' platform.
#[cfg(all(test, target_os = "macos"))]
Expand Down
Loading
Loading