chore: hide selection function (#1003)

This commit is contained in:
BiggerRain
2025-12-05 17:58:40 +08:00
committed by GitHub
parent 10ee3cd9d3
commit 378d5aef69
6 changed files with 24 additions and 29 deletions

View File

@@ -14,8 +14,8 @@ use once_cell::sync::Lazy;
use std::sync::Mutex; use std::sync::Mutex;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
/// Global toggle: selection monitoring enabled by default. /// Global toggle: selection monitoring disabled for this release.
static SELECTION_ENABLED: AtomicBool = AtomicBool::new(true); static SELECTION_ENABLED: AtomicBool = AtomicBool::new(false);
/// Ensure we only start the monitor thread once. Allows delayed start after /// Ensure we only start the monitor thread once. Allows delayed start after
/// Accessibility permission is granted post-launch. /// Accessibility permission is granted post-launch.

View File

@@ -21,8 +21,8 @@ import SettingsInput from "@/components//Settings/SettingsInput";
import platformAdapter from "@/utils/platformAdapter"; import platformAdapter from "@/utils/platformAdapter";
import UpdateSettings from "./components/UpdateSettings"; import UpdateSettings from "./components/UpdateSettings";
import SettingsToggle from "../SettingsToggle"; import SettingsToggle from "../SettingsToggle";
import SelectionSettings from "./components/Selection"; // import SelectionSettings from "./components/Selection";
import { isMac } from "@/utils/platform"; // import { isMac } from "@/utils/platform";
const Advanced = () => { const Advanced = () => {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -191,7 +191,7 @@ const Advanced = () => {
})} })}
</div> </div>
{isMac && <SelectionSettings />} {/* {isMac && <SelectionSettings />} */}
<Shortcuts /> <Shortcuts />

View File

@@ -18,6 +18,7 @@ export const useTray = () => {
const showCocoShortcuts = useAppStore((state) => state.showCocoShortcuts); const showCocoShortcuts = useAppStore((state) => state.showCocoShortcuts);
const selectionEnabled = useSelectionStore((state) => state.selectionEnabled); const selectionEnabled = useSelectionStore((state) => state.selectionEnabled);
// const setSelectionEnabled = useSelectionStore((state) => state.setSelectionEnabled);
useUpdateEffect(() => { useUpdateEffect(() => {
if (showCocoShortcuts.length === 0) return; if (showCocoShortcuts.length === 0) return;
@@ -64,24 +65,18 @@ export const useTray = () => {
itemPromises.push(PredefinedMenuItem.new({ item: "Separator" })); itemPromises.push(PredefinedMenuItem.new({ item: "Separator" }));
if (isMac) { // if (isMac) {
itemPromises.push( // itemPromises.push(
MenuItem.new({ // MenuItem.new({
text: selectionEnabled // text: selectionEnabled
? t("tray.selectionDisable") // ? t("tray.selectionDisable")
: t("tray.selectionEnable"), // : t("tray.selectionEnable"),
action: async () => { // action: async () => {
try { // setSelectionEnabled(!selectionEnabled);
await platformAdapter.invokeBackend("set_selection_enabled", { // },
enabled: !selectionEnabled, // })
}); // );
} catch (e) { // }
console.error("set_selection_enabled invoke failed:", e);
}
},
})
);
}
itemPromises.push( itemPromises.push(
MenuItem.new({ MenuItem.new({

View File

@@ -9,7 +9,7 @@ const SettingsPage = lazy(() => import("@/pages/settings/index"));
const StandaloneChat = lazy(() => import("@/pages/chat/index")); const StandaloneChat = lazy(() => import("@/pages/chat/index"));
const WebPage = lazy(() => import("@/pages/web/index")); const WebPage = lazy(() => import("@/pages/web/index"));
const CheckPage = lazy(() => import("@/pages/check/index")); const CheckPage = lazy(() => import("@/pages/check/index"));
const SelectionWindow = lazy(() => import("@/pages/selection/index")); // const SelectionWindow = lazy(() => import("@/pages/selection/index"));
const routerOptions = { const routerOptions = {
basename: "/", basename: "/",
@@ -30,7 +30,7 @@ export const router = createBrowserRouter(
{ path: "/ui/settings", element: (<Suspense fallback={<></>}><SettingsPage /></Suspense>) }, { path: "/ui/settings", element: (<Suspense fallback={<></>}><SettingsPage /></Suspense>) },
{ path: "/ui/chat", element: (<Suspense fallback={<></>}><StandaloneChat /></Suspense>) }, { path: "/ui/chat", element: (<Suspense fallback={<></>}><StandaloneChat /></Suspense>) },
{ path: "/ui/check", element: (<Suspense fallback={<></>}><CheckPage /></Suspense>) }, { path: "/ui/check", element: (<Suspense fallback={<></>}><CheckPage /></Suspense>) },
{ path: "/ui/selection", element: (<Suspense fallback={<></>}><SelectionWindow /></Suspense>) }, // { path: "/ui/selection", element: (<Suspense fallback={<></>}><SelectionWindow /></Suspense>) },
{ path: "/web", element: (<Suspense fallback={<></>}><WebPage /></Suspense>) }, { path: "/web", element: (<Suspense fallback={<></>}><WebPage /></Suspense>) },
], ],
}, },

View File

@@ -18,7 +18,7 @@ import { useExtensionsStore } from "@/stores/extensionsStore";
import { useSelectionStore } from "@/stores/selectionStore"; import { useSelectionStore } from "@/stores/selectionStore";
import { useServers } from "@/hooks/useServers"; import { useServers } from "@/hooks/useServers";
import { useDeepLinkManager } from "@/hooks/useDeepLinkManager"; import { useDeepLinkManager } from "@/hooks/useDeepLinkManager";
import { useSelectionWindow } from "@/hooks/useSelectionWindow"; // import { useSelectionWindow } from "@/hooks/useSelectionWindow";
export default function LayoutOutlet() { export default function LayoutOutlet() {
const location = useLocation(); const location = useLocation();
@@ -125,7 +125,7 @@ export default function LayoutOutlet() {
}); });
// --- Selection window --- // --- Selection window ---
useSelectionWindow(); // useSelectionWindow();
return ( return (
<> <>
@@ -133,4 +133,4 @@ export default function LayoutOutlet() {
<ErrorNotification /> <ErrorNotification />
</> </>
); );
} }

View File

@@ -33,7 +33,7 @@ export const useSelectionStore = create<SelectionStore>((set) => ({
setIconsOnly: (iconsOnly) => set({ iconsOnly }), setIconsOnly: (iconsOnly) => set({ iconsOnly }),
toolbarConfig: [], toolbarConfig: [],
setToolbarConfig: (toolbarConfig) => set({ toolbarConfig }), setToolbarConfig: (toolbarConfig) => set({ toolbarConfig }),
selectionEnabled: true, selectionEnabled: false,
setSelectionEnabled: (selectionEnabled) => set({ selectionEnabled }), setSelectionEnabled: (selectionEnabled) => set({ selectionEnabled }),
})); }));