app autostart on boot (havent tested, hopefully works)

This commit is contained in:
2026-09-04 15:04:04 +08:00
parent b3a74d45c1
commit 927f82e8c9
10 changed files with 175 additions and 23 deletions
+23
View File
@@ -0,0 +1,23 @@
use tauri::AppHandle;
use tauri_plugin_autostart::ManagerExt;
use crate::db;
#[tauri::command]
#[specta::specta]
pub fn get_autostart_enabled(handle: AppHandle) -> Result<bool, String> {
handle.autolaunch().is_enabled().map_err(db::command_error)
}
#[tauri::command]
#[specta::specta]
pub fn set_autostart_enabled(handle: AppHandle, enabled: bool) -> Result<bool, String> {
let manager = handle.autolaunch();
if enabled {
manager.enable()
} else {
manager.disable()
}
.map_err(db::command_error)?;
manager.is_enabled().map_err(db::command_error)
}