Skip to content

armgit / Handy

Public Imported from GitHub
0

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

rearrange some ui (#1123)

CJ Pais32687d19e1c0
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 0d7211da..d70c8daf 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -50,18 +50,18 @@ export const SECTIONS_CONFIG = {
component: AdvancedSettings,
enabled: () => true,
},
- postprocessing: {
- labelKey: "sidebar.postProcessing",
- icon: Sparkles,
- component: PostProcessingSettings,
- enabled: (settings) => settings?.post_process_enabled ?? false,
- },
history: {
labelKey: "sidebar.history",
icon: History,
component: HistorySettings,
enabled: () => true,
},
+ postprocessing: {
+ labelKey: "sidebar.postProcessing",
+ icon: Sparkles,
+ component: PostProcessingSettings,
+ enabled: (settings) => settings?.post_process_enabled ?? false,
+ },
debug: {
labelKey: "sidebar.debug",
icon: FlaskConical,
diff --git a/src/components/settings/GlobalShortcutInput.tsx b/src/components/settings/GlobalShortcutInput.tsx
index 66be894b..537a782a 100644
--- a/src/components/settings/GlobalShortcutInput.tsx
+++ b/src/components/settings/GlobalShortcutInput.tsx
@@ -49,24 +49,6 @@ export const GlobalShortcutInput: React.FC<GlobalShortcutInputProps> = ({
const handleKeyDown = async (e: KeyboardEvent) => {
if (cleanup) return;
if (e.repeat) return; // ignore auto-repeat
- if (e.key === "Escape") {
- // Cancel recording and restore original binding
- if (editingShortcutId && originalBinding) {
- try {
- await updateBinding(editingShortcutId, originalBinding);
- } catch (error) {
- console.error("Failed to restore original binding:", error);
- toast.error(t("settings.general.shortcut.errors.restore"));
- }
- } else if (editingShortcutId) {
- await commands.resumeBinding(editingShortcutId).catch(console.error);
- }
- setEditingShortcutId(null);
- setKeyPressed([]);
- setRecordedKeys([]);
- setOriginalBinding("");
- return;
- }
e.preventDefault();
// Get the key with OS-specific naming and normalize it
diff --git a/src/components/settings/HandyKeysShortcutInput.tsx b/src/components/settings/HandyKeysShortcutInput.tsx
index ee1d5f53..d5f5ed03 100644
--- a/src/components/settings/HandyKeysShortcutInput.tsx
+++ b/src/components/settings/HandyKeysShortcutInput.tsx
@@ -134,19 +134,8 @@ export const HandyKeysShortcutInput: React.FC<HandyKeysShortcutInputProps> = ({
setupListener();
- // Handle escape key to cancel
- const handleKeyDown = (e: KeyboardEvent) => {
- if (e.key === "Escape") {
- e.preventDefault();
- cancelRecording();
- }
- };
-
- window.addEventListener("keydown", handleKeyDown);
-
return () => {
cleanup = true;
- window.removeEventListener("keydown", handleKeyDown);
if (unlistenRef.current) {
unlistenRef.current();
unlistenRef.current = null;
diff --git a/src/components/settings/debug/DebugSettings.tsx b/src/components/settings/debug/DebugSettings.tsx
index 49bd9ec6..442febfd 100644
--- a/src/components/settings/debug/DebugSettings.tsx
+++ b/src/components/settings/debug/DebugSettings.tsx
@@ -1,6 +1,5 @@
import React from "react";
import { useTranslation } from "react-i18next";
-import { type } from "@tauri-apps/plugin-os";
import { WordCorrectionThreshold } from "./WordCorrectionThreshold";
import { LogLevelSelector } from "./LogLevelSelector";
import { PasteDelay } from "./PasteDelay";
@@ -9,15 +8,10 @@ import { SettingsGroup } from "../../ui/SettingsGroup";
import { AlwaysOnMicrophone } from "../AlwaysOnMicrophone";
import { SoundPicker } from "../SoundPicker";
import { ClamshellMicrophoneSelector } from "../ClamshellMicrophoneSelector";
-import { ShortcutInput } from "../ShortcutInput";
import { UpdateChecksToggle } from "../UpdateChecksToggle";
-import { useSettings } from "../../../hooks/useSettings";
export const DebugSettings: React.FC = () => {
const { t } = useTranslation();
- const { getSetting } = useSettings();
- const pushToTalk = getSetting("push_to_talk");
- const isLinux = type() === "linux";
return (
<div className="max-w-3xl w-full mx-auto space-y-6">
@@ -33,14 +27,6 @@ export const DebugSettings: React.FC = () => {
<RecordingBuffer descriptionMode="tooltip" grouped={true} />
<AlwaysOnMicrophone descriptionMode="tooltip" grouped={true} />
<ClamshellMicrophoneSelector descriptionMode="tooltip" grouped={true} />
- {/* Cancel shortcut is disabled on Linux due to instability with dynamic shortcut registration */}
- {!isLinux && (
- <ShortcutInput
- shortcutId="cancel"
- grouped={true}
- disabled={pushToTalk}
- />
- )}
</SettingsGroup>
</div>
);
diff --git a/src/components/settings/general/GeneralSettings.tsx b/src/components/settings/general/GeneralSettings.tsx
index 88bedf8c..adbb6787 100644
--- a/src/components/settings/general/GeneralSettings.tsx
+++ b/src/components/settings/general/GeneralSettings.tsx
@@ -1,5 +1,6 @@
import React from "react";
import { useTranslation } from "react-i18next";
+import { type } from "@tauri-apps/plugin-os";
import { MicrophoneSelector } from "../MicrophoneSelector";
import { ShortcutInput } from "../ShortcutInput";
import { SettingsGroup } from "../../ui/SettingsGroup";
@@ -13,12 +14,18 @@ import { ModelSettingsCard } from "./ModelSettingsCard";
export const GeneralSettings: React.FC = () => {
const { t } = useTranslation();
- const { audioFeedbackEnabled } = useSettings();
+ const { audioFeedbackEnabled, getSetting } = useSettings();
+ const pushToTalk = getSetting("push_to_talk");
+ const isLinux = type() === "linux";
return (
<div className="max-w-3xl w-full mx-auto space-y-6">
<SettingsGroup title={t("settings.general.title")}>
<ShortcutInput shortcutId="transcribe" grouped={true} />
<PushToTalk descriptionMode="tooltip" grouped={true} />
+ {/* Cancel shortcut is hidden with push-to-talk (release key cancels) and on Linux (dynamic shortcut instability) */}
+ {!isLinux && !pushToTalk && (
+ <ShortcutInput shortcutId="cancel" grouped={true} />
+ )}
</SettingsGroup>
<ModelSettingsCard />
<SettingsGroup title={t("settings.sound.title")}>
diff --git a/src/i18n/locales/bg/translation.json b/src/i18n/locales/bg/translation.json
index 617da9d3..10d63893 100644
--- a/src/i18n/locales/bg/translation.json
+++ b/src/i18n/locales/bg/translation.json
@@ -547,7 +547,10 @@
"downloading": "Изтегля се... {{progress}}%",
"installing": "Инсталиране...",
"preparing": "Подготовка...",
- "checkForUpdates": "Проверка за актуализации"
+ "checkForUpdates": "Проверка за актуализации",
+ "portableUpdateTitle": "Необходима е ръчна актуализация",
+ "portableUpdateMessage": "Преносимите инсталации не могат да бъдат актуализирани автоматично. За актуализация: изтеглете най-новия NSIS инсталатор от GitHub Releases, инсталирайте го в същата папка, след което копирайте папката Data/ (настройки, модели, записи) от старата версия в новата.",
+ "portableUpdateButton": "Отвори GitHub Releases"
},
"common": {
"loading": "Зареждане...",