macOS accessory mode

This commit is contained in:
2026-03-21 00:24:00 +08:00
parent 680fd3c617
commit 16811a8243
2 changed files with 18 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ use crate::{
},
state::init_app_state,
system_tray::init_system_tray,
utilities::toggle_macos_accessory_mode,
};
pub mod lifecycle;
@@ -20,6 +21,7 @@ pub mod tracing;
/// init and startup of everything.
pub async fn launch_app() {
init_logging();
toggle_macos_accessory_mode(false); // TODO: toggle true once figure out consolidated window management solution
open_splash_window();
update_app().await;
init_app_state();

View File

@@ -27,3 +27,19 @@ macro_rules! lock_w {
}
}};
}
pub fn toggle_macos_accessory_mode(enabled: bool) {
#[cfg(target_os = "macos")]
{
use crate::get_app_handle;
let app = get_app_handle();
if enabled {
app.set_activation_policy(tauri::ActivationPolicy::Accessory)
.expect("Failed to set activation policy to accessory mode");
} else {
app.set_activation_policy(tauri::ActivationPolicy::Regular)
.expect("Failed to set activation policy to regular mode");
}
}
}