60 lines
1.9 KiB
Rust

mod commands;
mod state;
pub mod utils;
mod window;
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))]
mod shortcut;
use state::new_shared_watcher_state;
use window::setup_window;
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))]
pub fn desktop() {
let watcher_state = new_shared_watcher_state();
tauri::Builder::default()
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_store::Builder::new().build())
.plugin(tauri_plugin_http::init())
.plugin(tauri_plugin_sharetarget::init())
// .plugin(tauri_plugin_dialog::init())
// .plugin(tauri_plugin_opener::init())
.manage(watcher_state)
.invoke_handler(tauri::generate_handler![
commands::handle_selected_folder,
shortcut::change_shortcut,
shortcut::unregister_shortcut,
shortcut::get_current_shortcut,
shortcut::change_screenshot_shortcut,
shortcut::unregister_screenshot_shortcut,
shortcut::get_current_screenshot_shortcut,
])
// .manage(watcher_state)
// .invoke_handler(tauri::generate_handler![commands::handle_selected_folder,])
.setup(|app| {
setup_window(app)?;
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
#[cfg(any(target_os = "ios", target_os = "android"))]
pub fn android() {
tauri::Builder::default()
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_store::Builder::new().build())
.plugin(tauri_plugin_http::init())
.plugin(tauri_plugin_sharetarget::init())
.setup(|app| {
setup_window(app)?;
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running android tauri application");
}