Skip to content

armgit / Handy

Public Imported from GitHub
0

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

default for post-process and revert ui changes

CJ Paisdb854363b408
diff --git a/src-tauri/src/settings.rs b/src-tauri/src/settings.rs
index 21f9903f..44402bc1 100644
--- a/src-tauri/src/settings.rs
+++ b/src-tauri/src/settings.rs
@@ -562,6 +562,15 @@ pub fn get_default_settings() -> AppSettings {
current_binding: default_shortcut.to_string(),
},
);
+ #[cfg(target_os = "windows")]
+ let default_post_process_shortcut = "ctrl+shift+space";
+ #[cfg(target_os = "macos")]
+ let default_post_process_shortcut = "option+shift+space";
+ #[cfg(target_os = "linux")]
+ let default_post_process_shortcut = "ctrl+shift+space";
+ #[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]
+ let default_post_process_shortcut = "alt+shift+space";
+
bindings.insert(
"transcribe_with_post_process".to_string(),
ShortcutBinding {
@@ -569,8 +578,8 @@ pub fn get_default_settings() -> AppSettings {
name: "Transcribe with Post-Processing".to_string(),
description: "Converts your speech into text and applies AI post-processing."
.to_string(),
- default_binding: String::new(),
- current_binding: String::new(),
+ default_binding: default_post_process_shortcut.to_string(),
+ current_binding: default_post_process_shortcut.to_string(),
},
);
bindings.insert(
diff --git a/src-tauri/src/shortcut/mod.rs b/src-tauri/src/shortcut/mod.rs
index 464b5645..6ff5a04b 100644
--- a/src-tauri/src/shortcut/mod.rs
+++ b/src-tauri/src/shortcut/mod.rs
@@ -108,6 +108,11 @@ pub fn change_binding(
id: String,
binding: String,
) -> Result<BindingResponse, String> {
+ // Reject empty bindings — every shortcut should have a value
+ if binding.trim().is_empty() {
+ return Err("Binding cannot be empty".to_string());
+ }
+
let mut settings = settings::get_settings(&app);
// Get the binding to modify, or create it from defaults if it doesn't exist
@@ -707,10 +712,7 @@ pub fn change_post_process_enabled_setting(app: AppHandle, enabled: bool) -> Res
.cloned()
{
if enabled {
- // Only register if the user has actually set a binding
- if !binding.current_binding.is_empty() {
- let _ = register_shortcut(&app, binding);
- }
+ let _ = register_shortcut(&app, binding);
} else {
let _ = unregister_shortcut(&app, binding);
}
diff --git a/src/components/settings/GlobalShortcutInput.tsx b/src/components/settings/GlobalShortcutInput.tsx
index 80d6b9ef..0bf45176 100644
--- a/src/components/settings/GlobalShortcutInput.tsx
+++ b/src/components/settings/GlobalShortcutInput.tsx
@@ -293,22 +293,16 @@ export const GlobalShortcutInput: React.FC<GlobalShortcutInputProps> = ({
{editingShortcutId === shortcutId ? (
<div
ref={(ref) => setShortcutRef(shortcutId, ref)}
- className="px-2 py-1 text-sm font-semibold border border-logo-primary bg-logo-primary/30 rounded min-w-[120px] text-center"
+ className="px-2 py-1 text-sm font-semibold border border-logo-primary bg-logo-primary/30 rounded"
>
{formatCurrentKeys()}
</div>
) : (
<div
- className={`px-2 py-1 text-sm font-semibold rounded cursor-pointer min-w-[120px] text-center ${
- binding.current_binding
- ? "bg-mid-gray/10 border border-mid-gray/80 hover:bg-logo-primary/10 hover:border-logo-primary"
- : "bg-mid-gray/5 border border-mid-gray/40 hover:bg-logo-primary/10 hover:border-logo-primary text-mid-gray/60"
- }`}
+ className="px-2 py-1 text-sm font-semibold bg-mid-gray/10 border border-mid-gray/80 hover:bg-logo-primary/10 rounded cursor-pointer hover:border-logo-primary"
onClick={() => startRecording(shortcutId)}
>
- {binding.current_binding
- ? formatKeyCombination(binding.current_binding, osType)
- : t("settings.general.shortcut.notSet")}
+ {formatKeyCombination(binding.current_binding, osType)}
</div>
)}
<ResetButton
diff --git a/src/components/settings/HandyKeysShortcutInput.tsx b/src/components/settings/HandyKeysShortcutInput.tsx
index 1f0d4cfd..2c936ab5 100644
--- a/src/components/settings/HandyKeysShortcutInput.tsx
+++ b/src/components/settings/HandyKeysShortcutInput.tsx
@@ -278,22 +278,16 @@ export const HandyKeysShortcutInput: React.FC<HandyKeysShortcutInputProps> = ({
{isRecording ? (
<div
ref={shortcutRef}
- className="px-2 py-1 text-sm font-semibold border border-logo-primary bg-logo-primary/30 rounded min-w-[120px] text-center"
+ className="px-2 py-1 text-sm font-semibold border border-logo-primary bg-logo-primary/30 rounded"
>
{formatCurrentKeys()}
</div>
) : (
<div
- className={`px-2 py-1 text-sm font-semibold rounded cursor-pointer min-w-[120px] text-center ${
- binding.current_binding
- ? "bg-mid-gray/10 border border-mid-gray/80 hover:bg-logo-primary/10 hover:border-logo-primary"
- : "bg-mid-gray/5 border border-mid-gray/40 hover:bg-logo-primary/10 hover:border-logo-primary text-mid-gray/60"
- }`}
+ className="px-2 py-1 text-sm font-semibold bg-mid-gray/10 border border-mid-gray/80 hover:bg-logo-primary/10 rounded cursor-pointer hover:border-logo-primary"
onClick={startRecording}
>
- {binding.current_binding
- ? formatKeyCombination(binding.current_binding, osType)
- : t("settings.general.shortcut.notSet")}
+ {formatKeyCombination(binding.current_binding, osType)}
</div>
)}
<ResetButton
diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json
index 8e7785fe..8ad3740c 100644
--- a/src/i18n/locales/en/translation.json
+++ b/src/i18n/locales/en/translation.json
@@ -110,7 +110,6 @@
"loading": "Loading shortcuts...",
"none": "No shortcuts configured",
"notFound": "Shortcut not found",
- "notSet": "Not set",
"pressKeys": "Press keys...",
"bindings": {
"transcribe": {