From a2339195aa940bff86d76375fd05087595bf06ce Mon Sep 17 00:00:00 2001 From: venkr Date: Tue, 26 Mar 2024 11:01:57 -0700 Subject: [PATCH] fix(autostart): Fix LaunchAgent macOS autostart (#1118) * Fix LaunchAgent macOS autostart * Add .changes --- .changes/fix-autolaunch-macos.md | 5 +++++ plugins/autostart/src/lib.rs | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 .changes/fix-autolaunch-macos.md diff --git a/.changes/fix-autolaunch-macos.md b/.changes/fix-autolaunch-macos.md new file mode 100644 index 00000000..83c4b207 --- /dev/null +++ b/.changes/fix-autolaunch-macos.md @@ -0,0 +1,5 @@ +--- +"autostart": patch +--- + +Fix LaunchAgent-based autostart for macOS. \ No newline at end of file diff --git a/plugins/autostart/src/lib.rs b/plugins/autostart/src/lib.rs index 264185a9..bd3866b3 100644 --- a/plugins/autostart/src/lib.rs +++ b/plugins/autostart/src/lib.rs @@ -129,11 +129,12 @@ pub fn init( // exe path to not break it. let exe_path = current_exe.canonicalize()?.display().to_string(); let parts: Vec<&str> = exe_path.split(".app/").collect(); - let app_path = if parts.len() == 2 { - format!("{}.app", parts.first().unwrap()) - } else { - exe_path - }; + let app_path = + if parts.len() == 2 && matches!(macos_launcher, MacosLauncher::AppleScript) { + format!("{}.app", parts.first().unwrap()) + } else { + exe_path + }; info!("auto_start path {}", &app_path); builder.set_app_path(&app_path); }