diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index d687062..ecfffd9 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -21,6 +21,11 @@
},
"globalShortcut": {
"all": true
+ },
+ "app": {
+ "all": true,
+ "hide": true,
+ "show": true
}
},
"bundle": {
diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx
index effbb4d..1c94e49 100644
--- a/src/components/ui/button.tsx
+++ b/src/components/ui/button.tsx
@@ -13,7 +13,7 @@ const buttonVariants = cva(
destructive:
"bg-red-500 text-gray-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-gray-50 dark:hover:bg-red-900/90",
outline:
- "border border-gray-200 bg-white hover:bg-gray-100 hover:text-gray-900 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50",
+ "border border-gray-200 hover:bg-gray-100 hover:text-gray-900 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50",
secondary:
"bg-gray-100 text-gray-900 hover:bg-gray-100/80 dark:bg-gray-800 dark:text-gray-50 dark:hover:bg-gray-800/80",
ghost: "hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-800 dark:hover:text-gray-50",
diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx
index 65119a1..5840357 100644
--- a/src/components/ui/card.tsx
+++ b/src/components/ui/card.tsx
@@ -9,7 +9,7 @@ const Card = React.forwardRef<
{children}
-
+
Close
diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx
index aae15c8..e4f864d 100644
--- a/src/components/ui/input.tsx
+++ b/src/components/ui/input.tsx
@@ -11,7 +11,7 @@ const Input = React.forwardRef(
{
const { updateClips, clips } = useClipStore()
- let unlistenTextUpdate: UnlistenFn
- let unlistenClipboard: () => Promise
- let monitorRunning = false
-
useEffect(() => {
- const debouncedUpdateClips = _.debounce((newText) => {
- updateClips(newText)
- }, 300)
- const unlistenFunctions = async () => {
- unlistenTextUpdate = await onTextUpdate((newText) => {
- console.log("new text::")
- debouncedUpdateClips(newText)
+ // Check if the window object is available
+ if (typeof window === "undefined") return;
+
+ const loadTauriModules = async () => {
+ const { register } = await import("@tauri-apps/api/globalShortcut")
+ const { appWindow } = await import("@tauri-apps/api/window")
+ const app = await import("@tauri-apps/api/app")
+ const { listenToMonitorStatusUpdate, onTextUpdate, startListening } = await import("tauri-plugin-clipboard-api")
+ const { exit } = await import('@tauri-apps/api/process')
+
+ let unlistenTextUpdate: UnlistenFn
+ let unlistenClipboard: () => Promise
+ let monitorRunning = false
+
+ await register("CommandOrControl+Shift+V", async () => {
+ await app.show()
+ await appWindow.unminimize()
+ await appWindow.setFocus()
})
- unlistenClipboard = await startListening()
- }
- listenToMonitorStatusUpdate((running) => {
- monitorRunning = running
- })
- unlistenFunctions().catch(console.error)
+ const debouncedUpdateClips = _.debounce((newText) => {
+ updateClips(newText)
+ }, 300)
- return () => {
- if (unlistenTextUpdate) {
- unlistenTextUpdate()
+ const unlistenFunctions = async () => {
+ unlistenTextUpdate = await onTextUpdate((newText) => {
+ console.log("new text::")
+ debouncedUpdateClips(newText)
+ })
+ unlistenClipboard = await startListening()
+ }
+
+ listenToMonitorStatusUpdate((running) => {
+ monitorRunning = running
+ })
+ unlistenFunctions().catch(console.error)
+
+ return () => {
+ if (unlistenTextUpdate) {
+ unlistenTextUpdate()
+ }
}
}
- }, [])
+
+ loadTauriModules()
+ }, [updateClips])
return (
@@ -86,7 +101,8 @@ const Home: NextPage = () => {