diff --git a/src-tauri/src/service/window.rs b/src-tauri/src/service/window.rs index df08f3ba..c4143478 100644 --- a/src-tauri/src/service/window.rs +++ b/src-tauri/src/service/window.rs @@ -76,7 +76,7 @@ pub fn get_data_path() -> DataPath { } } -pub fn sync_clipboard_history() { +pub async fn sync_clipboard_history() -> Result<(), ()> { let data_path = get_data_path(); // get local config from app data @@ -116,4 +116,6 @@ pub fn sync_clipboard_history() { serde_json::to_string(&config).unwrap(), ); } + + Ok(()) } diff --git a/src-tauri/src/utils/hotkey/hotkey_listener.rs b/src-tauri/src/utils/hotkey/hotkey_listener.rs index 633086c8..5cdc89a7 100644 --- a/src-tauri/src/utils/hotkey/hotkey_listener.rs +++ b/src-tauri/src/utils/hotkey/hotkey_listener.rs @@ -63,9 +63,9 @@ pub async fn parse_hotkey_event(key: &Key) { match event { Ok(HotkeyEvent::WindowDisplayToggle) => toggle_main_window(), Ok(HotkeyEvent::TypeClipboard) => type_last_clipboard().await, - Ok(HotkeyEvent::SyncClipboardHistory) => sync_clipboard_history(), - Ok(HotkeyEvent::Preferences) => window.emit("open_preferences_window", Some(())).unwrap(), - Ok(HotkeyEvent::About) => window.emit("open_about_window", Some(())).unwrap(), + Ok(HotkeyEvent::SyncClipboardHistory) => sync_clipboard_history().await.unwrap(), + Ok(e @ HotkeyEvent::Preferences) => window.emit("open_window", Some(e.as_str())).unwrap(), + Ok(e @ HotkeyEvent::About) => window.emit("open_window", Some(e.as_str())).unwrap(), Ok(HotkeyEvent::Exit) => APP.get().unwrap().exit(1), Ok( e @ (HotkeyEvent::RecentClipboard