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]
|
#[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>(
|
let result = sqlx::query_scalar::<_, String>(
|
||||||
"SELECT value FROM settings WHERE key = 'keybind'"
|
"SELECT value FROM settings WHERE key = 'keybind'"
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,10 +10,7 @@ fn key_to_string(key: &Key) -> String {
|
||||||
#[warn(dead_code)]
|
#[warn(dead_code)]
|
||||||
pub fn setup(app_handle: tauri::AppHandle) {
|
pub fn setup(app_handle: tauri::AppHandle) {
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let pool = app_handle.state::<sqlx::SqlitePool>();
|
let keybind = tauri::async_runtime::block_on(async { get_keybind(app_handle.clone()).await.unwrap_or_default() });
|
||||||
let rt = app_handle.state::<tokio::runtime::Runtime>();
|
|
||||||
|
|
||||||
let keybind = rt.block_on(async { get_keybind(pool).await.unwrap_or_default() });
|
|
||||||
|
|
||||||
println!("Listening for keybind: {:?}", keybind);
|
println!("Listening for keybind: {:?}", keybind);
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,9 @@ fn main() {
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
let app_handle = app.handle().clone();
|
let app_handle = app.handle().clone();
|
||||||
|
|
||||||
// #[cfg(not(target_os = "macos"))]
|
let _ = api::database::setup(app);
|
||||||
api::hotkeys::setup(app_handle.clone());
|
api::hotkeys::setup(app_handle.clone());
|
||||||
api::tray::setup(app)?;
|
api::tray::setup(app)?;
|
||||||
let _ = api::database::setup(app);
|
|
||||||
api::clipboard::setup(app.handle());
|
api::clipboard::setup(app.handle());
|
||||||
let _ = api::clipboard::start_monitor(app_handle.clone());
|
let _ = api::clipboard::start_monitor(app_handle.clone());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue