Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

drop 'direct' paste method from the ui for macOS (#1708)

CJ Pais3cbbe58272e2
diff --git a/src/components/settings/PasteMethod.tsx b/src/components/settings/PasteMethod.tsx
index 52df551c..bac9e2c1 100644
--- a/src/components/settings/PasteMethod.tsx
+++ b/src/components/settings/PasteMethod.tsx
@@ -1,6 +1,6 @@
import React from "react";
import { useTranslation } from "react-i18next";
-import { Dropdown } from "../ui/Dropdown";
+import { Dropdown, type DropdownOption } from "../ui/Dropdown";
import { SettingContainer } from "../ui/SettingContainer";
import { Input } from "../ui/Input";
import { useSettings } from "../../hooks/useSettings";
@@ -18,25 +18,35 @@ export const PasteMethodSetting: React.FC<PasteMethodProps> = React.memo(
const { getSetting, updateSetting, isUpdating } = useSettings();
const osType = useOsType();
+ const selectedMethod = (getSetting("paste_method") ||
+ "ctrl_v") as PasteMethod;
+
const getPasteMethodOptions = (osType: string) => {
const mod = osType === "macos" ? "Cmd" : "Ctrl";
- const options = [
+ const options: DropdownOption[] = [
{
value: "ctrl_v",
label: t("settings.advanced.pasteMethod.options.clipboard", {
modifier: mod,
}),
},
- {
+ ];
+
+ // Direct input is not offered on macOS, but keep an existing/manual
+ // selection visible so the UI accurately represents the saved setting.
+ if (osType !== "macos" || selectedMethod === "direct") {
+ options.push({
value: "direct",
label: t("settings.advanced.pasteMethod.options.direct"),
- },
- {
- value: "none",
- label: t("settings.advanced.pasteMethod.options.none"),
- },
- ];
+ disabled: osType === "macos",
+ });
+ }
+
+ options.push({
+ value: "none",
+ label: t("settings.advanced.pasteMethod.options.none"),
+ });
// Add Shift+Insert and Ctrl+Shift+V options for Windows and Linux only
if (osType === "windows" || osType === "linux") {
@@ -67,8 +77,6 @@ export const PasteMethodSetting: React.FC<PasteMethodProps> = React.memo(
return options;
};
- const selectedMethod = (getSetting("paste_method") ||
- "ctrl_v") as PasteMethod;
const externalScriptPath = getSetting("external_script_path") || "";
const pasteMethodOptions = getPasteMethodOptions(osType);