default for post-process and revert ui changes
This commit is contained in:
parent
462b03b024
commit
db854363b4
5 changed files with 23 additions and 25 deletions
|
|
@ -562,6 +562,15 @@ pub fn get_default_settings() -> AppSettings {
|
||||||
current_binding: default_shortcut.to_string(),
|
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(
|
bindings.insert(
|
||||||
"transcribe_with_post_process".to_string(),
|
"transcribe_with_post_process".to_string(),
|
||||||
ShortcutBinding {
|
ShortcutBinding {
|
||||||
|
|
@ -569,8 +578,8 @@ pub fn get_default_settings() -> AppSettings {
|
||||||
name: "Transcribe with Post-Processing".to_string(),
|
name: "Transcribe with Post-Processing".to_string(),
|
||||||
description: "Converts your speech into text and applies AI post-processing."
|
description: "Converts your speech into text and applies AI post-processing."
|
||||||
.to_string(),
|
.to_string(),
|
||||||
default_binding: String::new(),
|
default_binding: default_post_process_shortcut.to_string(),
|
||||||
current_binding: String::new(),
|
current_binding: default_post_process_shortcut.to_string(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
bindings.insert(
|
bindings.insert(
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,11 @@ pub fn change_binding(
|
||||||
id: String,
|
id: String,
|
||||||
binding: String,
|
binding: String,
|
||||||
) -> Result<BindingResponse, 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);
|
let mut settings = settings::get_settings(&app);
|
||||||
|
|
||||||
// Get the binding to modify, or create it from defaults if it doesn't exist
|
// 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()
|
.cloned()
|
||||||
{
|
{
|
||||||
if enabled {
|
if enabled {
|
||||||
// Only register if the user has actually set a binding
|
let _ = register_shortcut(&app, binding);
|
||||||
if !binding.current_binding.is_empty() {
|
|
||||||
let _ = register_shortcut(&app, binding);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let _ = unregister_shortcut(&app, binding);
|
let _ = unregister_shortcut(&app, binding);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -293,22 +293,16 @@ export const GlobalShortcutInput: React.FC<GlobalShortcutInputProps> = ({
|
||||||
{editingShortcutId === shortcutId ? (
|
{editingShortcutId === shortcutId ? (
|
||||||
<div
|
<div
|
||||||
ref={(ref) => setShortcutRef(shortcutId, ref)}
|
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()}
|
{formatCurrentKeys()}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
className={`px-2 py-1 text-sm font-semibold rounded cursor-pointer min-w-[120px] text-center ${
|
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"
|
||||||
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"
|
|
||||||
}`}
|
|
||||||
onClick={() => startRecording(shortcutId)}
|
onClick={() => startRecording(shortcutId)}
|
||||||
>
|
>
|
||||||
{binding.current_binding
|
{formatKeyCombination(binding.current_binding, osType)}
|
||||||
? formatKeyCombination(binding.current_binding, osType)
|
|
||||||
: t("settings.general.shortcut.notSet")}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<ResetButton
|
<ResetButton
|
||||||
|
|
|
||||||
|
|
@ -278,22 +278,16 @@ export const HandyKeysShortcutInput: React.FC<HandyKeysShortcutInputProps> = ({
|
||||||
{isRecording ? (
|
{isRecording ? (
|
||||||
<div
|
<div
|
||||||
ref={shortcutRef}
|
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()}
|
{formatCurrentKeys()}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
className={`px-2 py-1 text-sm font-semibold rounded cursor-pointer min-w-[120px] text-center ${
|
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"
|
||||||
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"
|
|
||||||
}`}
|
|
||||||
onClick={startRecording}
|
onClick={startRecording}
|
||||||
>
|
>
|
||||||
{binding.current_binding
|
{formatKeyCombination(binding.current_binding, osType)}
|
||||||
? formatKeyCombination(binding.current_binding, osType)
|
|
||||||
: t("settings.general.shortcut.notSet")}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<ResetButton
|
<ResetButton
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@
|
||||||
"loading": "Loading shortcuts...",
|
"loading": "Loading shortcuts...",
|
||||||
"none": "No shortcuts configured",
|
"none": "No shortcuts configured",
|
||||||
"notFound": "Shortcut not found",
|
"notFound": "Shortcut not found",
|
||||||
"notSet": "Not set",
|
|
||||||
"pressKeys": "Press keys...",
|
"pressKeys": "Press keys...",
|
||||||
"bindings": {
|
"bindings": {
|
||||||
"transcribe": {
|
"transcribe": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue