app autostart on boot (havent tested, hopefully works)
This commit is contained in:
@@ -50,6 +50,10 @@ pub fn run() {
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.plugin(tauri_plugin_autostart::init(
|
||||
tauri_plugin_autostart::MacosLauncher::LaunchAgent,
|
||||
None,
|
||||
))
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.invoke_handler(specta_builder.invoke_handler())
|
||||
@@ -110,6 +114,8 @@ fn specta_builder() -> tauri_specta::Builder<tauri::Wry> {
|
||||
onboarding::get_onboarding_status,
|
||||
onboarding::complete_onboarding,
|
||||
macos::request_accessibility_permission,
|
||||
settings::autostart::get_autostart_enabled,
|
||||
settings::autostart::set_autostart_enabled,
|
||||
settings::get_locale_settings,
|
||||
settings::set_locale_preference,
|
||||
ui::control_panel::open_action_window,
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
pub mod autostart;
|
||||
|
||||
use std::sync::RwLock;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
Reference in New Issue
Block a user