auto start stuff?
This commit is contained in:
parent
3414a6aee8
commit
1e976d62b1
2 changed files with 32 additions and 9 deletions
|
|
@ -1,6 +1,17 @@
|
||||||
{
|
{
|
||||||
"identifier": "desktop-capability",
|
"identifier": "desktop-capability",
|
||||||
"platforms": ["macOS", "windows", "linux"],
|
"platforms": [
|
||||||
"windows": ["main"],
|
"macOS",
|
||||||
"permissions": ["autostart:default", "global-shortcut:default"]
|
"windows",
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"windows": [
|
||||||
|
"main"
|
||||||
|
],
|
||||||
|
"permissions": [
|
||||||
|
"autostart:default",
|
||||||
|
"global-shortcut:default",
|
||||||
|
"autostart:default",
|
||||||
|
"autostart:default"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -12,7 +12,7 @@ use tauri::image::Image;
|
||||||
use tauri::menu::{Menu, MenuItem};
|
use tauri::menu::{Menu, MenuItem};
|
||||||
use tauri::tray::TrayIconBuilder;
|
use tauri::tray::TrayIconBuilder;
|
||||||
use tauri::Manager;
|
use tauri::Manager;
|
||||||
use tauri_plugin_autostart::MacosLauncher;
|
use tauri_plugin_autostart::{MacosLauncher, ManagerExt};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct ShortcutToggleStates {
|
struct ShortcutToggleStates {
|
||||||
|
|
@ -29,14 +29,14 @@ pub fn run() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.plugin(tauri_plugin_os::init())
|
.plugin(tauri_plugin_os::init())
|
||||||
.plugin(tauri_plugin_clipboard_manager::init())
|
.plugin(tauri_plugin_clipboard_manager::init())
|
||||||
.plugin(tauri_plugin_autostart::init(
|
|
||||||
MacosLauncher::LaunchAgent,
|
|
||||||
Some(vec!["--auto-launch"]),
|
|
||||||
))
|
|
||||||
.plugin(tauri_plugin_macos_permissions::init())
|
.plugin(tauri_plugin_macos_permissions::init())
|
||||||
.plugin(tauri_plugin_opener::init())
|
.plugin(tauri_plugin_opener::init())
|
||||||
.plugin(tauri_plugin_store::Builder::default().build())
|
.plugin(tauri_plugin_store::Builder::default().build())
|
||||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||||
|
.plugin(tauri_plugin_autostart::init(
|
||||||
|
MacosLauncher::LaunchAgent,
|
||||||
|
Some(vec![]),
|
||||||
|
))
|
||||||
.manage(Mutex::new(ShortcutToggleStates::default()))
|
.manage(Mutex::new(ShortcutToggleStates::default()))
|
||||||
.setup(move |app| {
|
.setup(move |app| {
|
||||||
let settings_i = MenuItem::with_id(app, "settings", "Settings", true, None::<&str>)?;
|
let settings_i = MenuItem::with_id(app, "settings", "Settings", true, None::<&str>)?;
|
||||||
|
|
@ -81,6 +81,18 @@ pub fn run() {
|
||||||
.build(app)?;
|
.build(app)?;
|
||||||
app.manage(tray);
|
app.manage(tray);
|
||||||
|
|
||||||
|
// Get the autostart manager
|
||||||
|
let autostart_manager = app.autolaunch();
|
||||||
|
// Enable autostart
|
||||||
|
let _ = autostart_manager.enable();
|
||||||
|
// Check enable state
|
||||||
|
println!(
|
||||||
|
"registered for autostart? {}",
|
||||||
|
autostart_manager.is_enabled().unwrap()
|
||||||
|
);
|
||||||
|
// Disable autostart
|
||||||
|
let _ = autostart_manager.disable();
|
||||||
|
|
||||||
let recording_manager = Arc::new(
|
let recording_manager = Arc::new(
|
||||||
AudioRecordingManager::new(app).expect("Failed to initialize recording manager"),
|
AudioRecordingManager::new(app).expect("Failed to initialize recording manager"),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue