Skip to content

Commit

Permalink
easy
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Oct 6, 2023
1 parent 5928a14 commit 0e77f76
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 53 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
72 changes: 36 additions & 36 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/src/service/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
10 changes: 6 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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();
Expand Down
13 changes: 1 addition & 12 deletions src/store/HotkeyStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function createHotkeyStore() {
hotkeys().find((h) => h.event === event);

const initHotkeys = async () => {
setGlobalHotkeyEvent(true);
// await unregisterAll();

const hotkeys = (await invoke<Hotkey[]>("get_hotkeys")).map((h) => ({
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/store/SettingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function createSettingsStore() {

const init = async () => {
await initSettings();

HotkeyStore.initHotkeys();
darkMode();
};
Expand Down

0 comments on commit 0e77f76

Please sign in to comment.