From a5d155f0ab411d76e1328444a00b3f6eeab200b9 Mon Sep 17 00:00:00 2001 From: Naden Date: Sun, 28 Apr 2024 17:12:06 +1000 Subject: [PATCH] Update --- src-tauri/src/handler_welcome.rs | 4 ++++ src-tauri/src/main.rs | 2 ++ src-tauri/src/windows.rs | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/handler_welcome.rs b/src-tauri/src/handler_welcome.rs index 62e18f2..679d597 100644 --- a/src-tauri/src/handler_welcome.rs +++ b/src-tauri/src/handler_welcome.rs @@ -8,6 +8,8 @@ use tauri::{AppHandle, Wry}; use crate::globals::{ONBOARDED, WELCOME_WINDOW}; use crate::handlers::database_core; use crate::windows::init_main_window; + +#[cfg(target_os = "macos")] use crate::windows_mac; #[tauri::command] @@ -67,6 +69,8 @@ pub async fn complete_onboarding(app_handle: AppHandle, allow_telemetry: bo // Init main window unsafe { ONBOARDED = true; } init_main_window(app_handle.clone()).await.unwrap(); + + #[cfg(target_os = "macos")] windows_mac::register_shortcut(app_handle.clone(), shortcut_key.to_string()); Ok(()) } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index c4a6013..c0fdf06 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -63,6 +63,8 @@ mod state; mod system_tray; mod windows; mod windows_main; + +#[cfg(target_os = "macos")] mod windows_mac; fn main() { diff --git a/src-tauri/src/windows.rs b/src-tauri/src/windows.rs index 8a8c707..9c01109 100644 --- a/src-tauri/src/windows.rs +++ b/src-tauri/src/windows.rs @@ -9,7 +9,10 @@ use tauri::{App, AppHandle, Manager}; use crate::globals::*; use crate::system_tray::{disable_system_tray, enable_system_tray}; -use crate::{windows_mac, windows_main}; +use crate::windows_main; + +#[cfg(target_os = "macos")] +use crate::windows_mac; pub async fn create_windows(app: &mut App) -> Result<()> { #[cfg(target_os = "macos")] @@ -60,6 +63,8 @@ pub async fn create_windows(app: &mut App) -> Result<()> { let shortcut_key = DATABASE_MANAGER.get().unwrap().core(move |c| settings_get(c, "appearance_shortcut_key".to_string()) ).await?.unwrap(); + + #[cfg(target_os = "macos")] windows_mac::register_shortcut(app.handle(), shortcut_key.to_string()); enable_system_tray(app.handle()).unwrap();