Skip to content
Draft
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
2 changes: 1 addition & 1 deletion plugins/autostart/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ serde = { workspace = true }
serde_json = { workspace = true }
tauri = { workspace = true }
thiserror = { workspace = true }
auto-launch = "0.5"
auto-launch = "0.6"
15 changes: 11 additions & 4 deletions plugins/autostart/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
)]
#![cfg(not(any(target_os = "android", target_os = "ios")))]

#[cfg(target_os = "macos")]
use auto_launch::MacOSLaunchMode;
use auto_launch::{AutoLaunch, AutoLaunchBuilder};
use serde::{ser::Serializer, Serialize};
use tauri::{
Expand Down Expand Up @@ -190,10 +192,10 @@ impl Builder {

#[cfg(target_os = "macos")]
{
builder.set_use_launch_agent(matches!(
self.macos_launcher,
MacosLauncher::LaunchAgent
));
builder.set_macos_launch_mode(match self.macos_launcher {
MacosLauncher::LaunchAgent => MacOSLaunchMode::LaunchAgent,
MacosLauncher::AppleScript => MacOSLaunchMode::AppleScript,
});
// on macOS, current_exe gives path to /Applications/Example.app/MacOS/Example
// but this results in seeing a Unix Executable in macOS login items
// It must be: /Applications/Example.app
Expand Down Expand Up @@ -222,6 +224,11 @@ impl Builder {
builder.set_app_path(&current_exe.display().to_string());
}

// FreeBSD has no AppImage concept and tauri's `Env` has no
// `appimage` field under FreeBSD, so just use the current exe path.
#[cfg(target_os = "freebsd")]
builder.set_app_path(&current_exe.display().to_string());

app.manage(AutoLaunchManager(
builder.build().map_err(|e| e.to_string())?,
));
Expand Down