diff --git a/src-tauri/src/api/database.rs b/src-tauri/src/api/database.rs index 33f15cd..32df120 100644 --- a/src-tauri/src/api/database.rs +++ b/src-tauri/src/api/database.rs @@ -135,7 +135,9 @@ pub async fn save_keybind( } #[tauri::command] -pub async fn get_keybind(pool: State<'_, SqlitePool>) -> Result, String> { +pub async fn get_keybind(app_handle: tauri::AppHandle) -> Result, String> { + let pool = app_handle.state::(); + let result = sqlx::query_scalar::<_, String>( "SELECT value FROM settings WHERE key = 'keybind'" ) diff --git a/src-tauri/src/api/hotkeys.rs b/src-tauri/src/api/hotkeys.rs index 079355d..8edcd7f 100644 --- a/src-tauri/src/api/hotkeys.rs +++ b/src-tauri/src/api/hotkeys.rs @@ -10,10 +10,7 @@ fn key_to_string(key: &Key) -> String { #[warn(dead_code)] pub fn setup(app_handle: tauri::AppHandle) { std::thread::spawn(move || { - let pool = app_handle.state::(); - let rt = app_handle.state::(); - - let keybind = rt.block_on(async { get_keybind(pool).await.unwrap_or_default() }); + let keybind = tauri::async_runtime::block_on(async { get_keybind(app_handle.clone()).await.unwrap_or_default() }); println!("Listening for keybind: {:?}", keybind); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index f1e069a..10c61f3 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -31,10 +31,9 @@ fn main() { .setup(|app| { let app_handle = app.handle().clone(); - // #[cfg(not(target_os = "macos"))] + let _ = api::database::setup(app); api::hotkeys::setup(app_handle.clone()); api::tray::setup(app)?; - let _ = api::database::setup(app); api::clipboard::setup(app.handle()); let _ = api::clipboard::start_monitor(app_handle.clone());