From 378d5aef699645cef25d6dc92a1f29383a6fc099 Mon Sep 17 00:00:00 2001
From: BiggerRain <15911122312@163.COM>
Date: Fri, 5 Dec 2025 17:58:40 +0800
Subject: [PATCH] chore: hide selection function (#1003)
---
src-tauri/src/selection_monitor.rs | 4 +--
src/components/Settings/Advanced/index.tsx | 6 ++---
src/hooks/useTray.ts | 31 +++++++++-------------
src/routes/index.tsx | 4 +--
src/routes/outlet.tsx | 6 ++---
src/stores/selectionStore.ts | 2 +-
6 files changed, 24 insertions(+), 29 deletions(-)
diff --git a/src-tauri/src/selection_monitor.rs b/src-tauri/src/selection_monitor.rs
index bfd36307..54d2f7c9 100644
--- a/src-tauri/src/selection_monitor.rs
+++ b/src-tauri/src/selection_monitor.rs
@@ -14,8 +14,8 @@ use once_cell::sync::Lazy;
use std::sync::Mutex;
use std::sync::atomic::{AtomicBool, Ordering};
-/// Global toggle: selection monitoring enabled by default.
-static SELECTION_ENABLED: AtomicBool = AtomicBool::new(true);
+/// Global toggle: selection monitoring disabled for this release.
+static SELECTION_ENABLED: AtomicBool = AtomicBool::new(false);
/// Ensure we only start the monitor thread once. Allows delayed start after
/// Accessibility permission is granted post-launch.
diff --git a/src/components/Settings/Advanced/index.tsx b/src/components/Settings/Advanced/index.tsx
index 34a61955..cee13b6f 100644
--- a/src/components/Settings/Advanced/index.tsx
+++ b/src/components/Settings/Advanced/index.tsx
@@ -21,8 +21,8 @@ import SettingsInput from "@/components//Settings/SettingsInput";
import platformAdapter from "@/utils/platformAdapter";
import UpdateSettings from "./components/UpdateSettings";
import SettingsToggle from "../SettingsToggle";
-import SelectionSettings from "./components/Selection";
-import { isMac } from "@/utils/platform";
+// import SelectionSettings from "./components/Selection";
+// import { isMac } from "@/utils/platform";
const Advanced = () => {
const { t } = useTranslation();
@@ -191,7 +191,7 @@ const Advanced = () => {
})}
- {isMac && }
+ {/* {isMac && } */}
diff --git a/src/hooks/useTray.ts b/src/hooks/useTray.ts
index 3a0638d8..1c731fdf 100644
--- a/src/hooks/useTray.ts
+++ b/src/hooks/useTray.ts
@@ -18,6 +18,7 @@ export const useTray = () => {
const showCocoShortcuts = useAppStore((state) => state.showCocoShortcuts);
const selectionEnabled = useSelectionStore((state) => state.selectionEnabled);
+ // const setSelectionEnabled = useSelectionStore((state) => state.setSelectionEnabled);
useUpdateEffect(() => {
if (showCocoShortcuts.length === 0) return;
@@ -64,24 +65,18 @@ export const useTray = () => {
itemPromises.push(PredefinedMenuItem.new({ item: "Separator" }));
- if (isMac) {
- itemPromises.push(
- MenuItem.new({
- text: selectionEnabled
- ? t("tray.selectionDisable")
- : t("tray.selectionEnable"),
- action: async () => {
- try {
- await platformAdapter.invokeBackend("set_selection_enabled", {
- enabled: !selectionEnabled,
- });
- } catch (e) {
- console.error("set_selection_enabled invoke failed:", e);
- }
- },
- })
- );
- }
+ // if (isMac) {
+ // itemPromises.push(
+ // MenuItem.new({
+ // text: selectionEnabled
+ // ? t("tray.selectionDisable")
+ // : t("tray.selectionEnable"),
+ // action: async () => {
+ // setSelectionEnabled(!selectionEnabled);
+ // },
+ // })
+ // );
+ // }
itemPromises.push(
MenuItem.new({
diff --git a/src/routes/index.tsx b/src/routes/index.tsx
index 67c665b2..3a4ea700 100644
--- a/src/routes/index.tsx
+++ b/src/routes/index.tsx
@@ -9,7 +9,7 @@ const SettingsPage = lazy(() => import("@/pages/settings/index"));
const StandaloneChat = lazy(() => import("@/pages/chat/index"));
const WebPage = lazy(() => import("@/pages/web/index"));
const CheckPage = lazy(() => import("@/pages/check/index"));
-const SelectionWindow = lazy(() => import("@/pages/selection/index"));
+// const SelectionWindow = lazy(() => import("@/pages/selection/index"));
const routerOptions = {
basename: "/",
@@ -30,7 +30,7 @@ export const router = createBrowserRouter(
{ path: "/ui/settings", element: (>}>) },
{ path: "/ui/chat", element: (>}>) },
{ path: "/ui/check", element: (>}>) },
- { path: "/ui/selection", element: (>}>) },
+ // { path: "/ui/selection", element: (>}>) },
{ path: "/web", element: (>}>) },
],
},
diff --git a/src/routes/outlet.tsx b/src/routes/outlet.tsx
index bf37901c..fbe1e113 100644
--- a/src/routes/outlet.tsx
+++ b/src/routes/outlet.tsx
@@ -18,7 +18,7 @@ import { useExtensionsStore } from "@/stores/extensionsStore";
import { useSelectionStore } from "@/stores/selectionStore";
import { useServers } from "@/hooks/useServers";
import { useDeepLinkManager } from "@/hooks/useDeepLinkManager";
-import { useSelectionWindow } from "@/hooks/useSelectionWindow";
+// import { useSelectionWindow } from "@/hooks/useSelectionWindow";
export default function LayoutOutlet() {
const location = useLocation();
@@ -125,7 +125,7 @@ export default function LayoutOutlet() {
});
// --- Selection window ---
- useSelectionWindow();
+ // useSelectionWindow();
return (
<>
@@ -133,4 +133,4 @@ export default function LayoutOutlet() {
>
);
-}
\ No newline at end of file
+}
diff --git a/src/stores/selectionStore.ts b/src/stores/selectionStore.ts
index 41848dc5..04374244 100644
--- a/src/stores/selectionStore.ts
+++ b/src/stores/selectionStore.ts
@@ -33,7 +33,7 @@ export const useSelectionStore = create((set) => ({
setIconsOnly: (iconsOnly) => set({ iconsOnly }),
toolbarConfig: [],
setToolbarConfig: (toolbarConfig) => set({ toolbarConfig }),
- selectionEnabled: true,
+ selectionEnabled: false,
setSelectionEnabled: (selectionEnabled) => set({ selectionEnabled }),
}));