mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-22 05:34:04 +02:00
fixed state/manage issues
This commit is contained in:
parent
78235f0e3d
commit
59d31ce5d9
3 changed files with 5 additions and 7 deletions
|
@ -135,7 +135,9 @@ pub async fn save_keybind(
|
|||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_keybind(pool: State<'_, SqlitePool>) -> Result<Vec<String>, String> {
|
||||
pub async fn get_keybind(app_handle: tauri::AppHandle) -> Result<Vec<String>, String> {
|
||||
let pool = app_handle.state::<SqlitePool>();
|
||||
|
||||
let result = sqlx::query_scalar::<_, String>(
|
||||
"SELECT value FROM settings WHERE key = 'keybind'"
|
||||
)
|
||||
|
|
|
@ -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::<sqlx::SqlitePool>();
|
||||
let rt = app_handle.state::<tokio::runtime::Runtime>();
|
||||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue