From 0e77f7639fd6f4f00d36e3fdd5f507b274fec736 Mon Sep 17 00:00:00 2001 From: "don.cryptus" Date: Fri, 6 Oct 2023 17:41:31 +0200 Subject: [PATCH] easy --- package.json | 2 +- src-tauri/Cargo.lock | 72 ++++++++++++++++----------------- src-tauri/src/service/window.rs | 1 + src/index.tsx | 10 +++-- src/store/HotkeyStore.ts | 13 +----- src/store/SettingsStore.ts | 1 + 6 files changed, 46 insertions(+), 53 deletions(-) diff --git a/package.json b/package.json index 538535ac..28de5219 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "prettier-plugin-tailwindcss": "^0.5.5", "tailwindcss": "^3.3.3", "typescript": "^5.2.2", - "vite": "^4.4.10", + "vite": "^4.4.11", "vite-plugin-checker": "^0.6.2", "vite-plugin-solid": "^2.7.0" } diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 98569c31..0d856cf6 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -299,7 +299,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -348,7 +348,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -365,7 +365,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -650,9 +650,9 @@ checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -792,7 +792,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1101,7 +1101,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1135,7 +1135,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1146,7 +1146,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1372,7 +1372,7 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1557,7 +1557,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1678,7 +1678,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2414,7 +2414,7 @@ checksum = "ce243b1bfa62ffc028f1cc3b6034ec63d649f3031bc8a4fbbb004e1ac17d1f68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2639,9 +2639,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libsqlite3-sys" @@ -3168,7 +3168,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3250,7 +3250,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3614,9 +3614,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "5b1106fec09662ec6dd98ccac0f81cef56984d0b49f75c92d8cbad76e20c005c" dependencies = [ "unicode-ident", ] @@ -4166,7 +4166,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4224,7 +4224,7 @@ dependencies = [ "proc-macro2", "quote", "sea-bae", - "syn 2.0.37", + "syn 2.0.38", "unicode-ident", ] @@ -4390,7 +4390,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4412,7 +4412,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4462,7 +4462,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4521,9 +4521,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b21f559e07218024e7e9f90f96f601825397de0e25420135f7f952453fed0b" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -4996,9 +4996,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.37" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -5265,7 +5265,7 @@ dependencies = [ [[package]] name = "tauri-plugin-autostart" version = "0.0.0" -source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#1f799ae25e357292dca58e8475fd6aebb1e1bbe3" +source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#9f27e6e4415ddf6c40f846d50c0d95c768cded77" dependencies = [ "auto-launch", "log", @@ -5425,7 +5425,7 @@ checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5519,7 +5519,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5652,7 +5652,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5926,7 +5926,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -5960,7 +5960,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6516,9 +6516,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907" dependencies = [ "memchr", ] diff --git a/src-tauri/src/service/window.rs b/src-tauri/src/service/window.rs index 8e09996a..a8f12b9f 100644 --- a/src-tauri/src/service/window.rs +++ b/src-tauri/src/service/window.rs @@ -32,6 +32,7 @@ pub fn toggle_main_window() { let _ = window.move_window(Position::BottomRight); let _ = window.show(); let _ = window.set_focus(); + init_event(); } init_hotkey_listener(); } diff --git a/src/index.tsx b/src/index.tsx index 1c9c2311..e4ff1e18 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,3 +1,4 @@ +import { invoke } from "@tauri-apps/api"; import { listen } from "@tauri-apps/api/event"; import { createResource, onMount } from "solid-js"; import { render } from "solid-js/web"; @@ -22,10 +23,11 @@ const Index = () => { const init_listener = await listen("init_listener", init); - // setTimeout(async () => { - // await invoke("stop_hotkeys"); - // setGlobalHotkeyEvent(false); - // }, 5000); + setTimeout(async () => { + await invoke("stop_hotkeys"); + console.log("stop_hotkeys"); + setGlobalHotkeyEvent(false); + }, 5000); return async () => { init_listener(); diff --git a/src/store/HotkeyStore.ts b/src/store/HotkeyStore.ts index 97b0bee6..9cfd30c2 100644 --- a/src/store/HotkeyStore.ts +++ b/src/store/HotkeyStore.ts @@ -21,6 +21,7 @@ function createHotkeyStore() { hotkeys().find((h) => h.event === event); const initHotkeys = async () => { + setGlobalHotkeyEvent(true); // await unregisterAll(); const hotkeys = (await invoke("get_hotkeys")).map((h) => ({ @@ -29,18 +30,6 @@ function createHotkeyStore() { })); setHotkeys(hotkeys); - - // // Display and hide the app window - // const windowHotkey = hotkeys.find( - // (h) => h.event === "window_display_toggle", - // ); - - // if (windowHotkey?.status && !(await isRegistered(windowHotkey.shortcut))) { - // register(windowHotkey.shortcut, () => { - // AppStore.updateSidebarIcons("Recent Clipboards"); - // invoke("window_display_toggle"); - // }).catch(() => {}); - // } }; return { diff --git a/src/store/SettingsStore.ts b/src/store/SettingsStore.ts index cfa6c14e..e1bc967e 100644 --- a/src/store/SettingsStore.ts +++ b/src/store/SettingsStore.ts @@ -62,6 +62,7 @@ function createSettingsStore() { const init = async () => { await initSettings(); + HotkeyStore.initHotkeys(); darkMode(); };