@@ -85,6 +85,11 @@ pub fn apply_start_at_login_default(app: &AppHandle) -> StartAtLogin {
8585/// It runs once, behind its own marker, and only where autostart is already on. It never turns the
8686/// setting on and never turns it off; the worst case is an entry that keeps its old arguments and a
8787/// login launch that shows its window, which is the visible failure rather than the silent one.
88+ ///
89+ /// On macOS the marker lives in a config directory every copy of the app shares, while the plugin
90+ /// rewrites whatever plist exists. The rewrite is therefore limited to this copy's own entry in the
91+ /// exact shape the plugin writes; another or a missing copy, or any key the rewrite would drop, is
92+ /// left untouched and unmarked (#6972).
8893pub fn adopt_launch_origin_argument ( app : & AppHandle ) {
8994 let Ok ( dir) = app. path ( ) . app_config_dir ( ) else {
9095 return ;
@@ -102,6 +107,23 @@ pub fn adopt_launch_origin_argument(app: &AppHandle) {
102107 // that is already enabled, so retrying after a transient registry, LaunchAgent or desktop-file
103108 // error is free — and claiming the marker first would suppress the migration permanently and
104109 // leave a login launch showing its window forever.
110+ #[ cfg( target_os = "macos" ) ]
111+ {
112+ use crate :: login_registration:: Migration ;
113+ let Ok ( home) = app. path ( ) . home_dir ( ) else {
114+ return ;
115+ } ;
116+ match crate :: login_registration:: judge_migration ( & home) {
117+ Migration :: Rewrite => {
118+ if crate :: login_autostart:: enable ( app) . is_err ( ) {
119+ return ;
120+ }
121+ }
122+ Migration :: Absent => { }
123+ Migration :: Leave => return ,
124+ }
125+ }
126+ #[ cfg( not( target_os = "macos" ) ) ]
105127 match app. autolaunch ( ) . is_enabled ( ) {
106128 Ok ( true ) => {
107129 if crate :: login_autostart:: enable ( app) . is_err ( ) {
0 commit comments