Skip to content

armgit / Handy

Public Imported from GitHub
0

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

fix(shortcuts): avoid the ibus hotkey on Linux defaults (#2367)

Bl0ck298653c86d7c
diff --git a/src-tauri/src/settings.rs b/src-tauri/src/settings.rs
index e01f5f38..03bcc8c4 100644
--- a/src-tauri/src/settings.rs
+++ b/src-tauri/src/settings.rs
@@ -945,7 +945,7 @@ pub fn get_default_settings() -> AppSettings {
#[cfg(target_os = "macos")]
let default_shortcut = "option+space";
#[cfg(target_os = "linux")]
- let default_shortcut = "ctrl+space";
+ let default_shortcut = "ctrl+alt+space";
#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]
let default_shortcut = "alt+space";
@@ -965,7 +965,7 @@ pub fn get_default_settings() -> AppSettings {
#[cfg(target_os = "macos")]
let default_post_process_shortcut = "option+shift+space";
#[cfg(target_os = "linux")]
- let default_post_process_shortcut = "ctrl+shift+space";
+ let default_post_process_shortcut = "ctrl+alt+shift+space";
#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]
let default_post_process_shortcut = "alt+shift+space";
@@ -1643,6 +1643,17 @@ mod tests {
assert_eq!(salvaged.custom_words, vec!["handy".to_string()]);
}
+ #[cfg(target_os = "linux")]
+ #[test]
+ fn default_shortcuts_do_not_conflict_with_ibus_input_method_switch() {
+ let defaults = get_default_settings();
+ assert_eq!(defaults.bindings["transcribe"].current_binding, "ctrl+alt+space");
+ assert_eq!(
+ defaults.bindings["transcribe_with_post_process"].current_binding,
+ "ctrl+alt+shift+space",
+ );
+ }
+
#[test]
fn salvage_of_poisoned_bindings_keeps_other_fields() {
let mut stored = default_settings_json();
diff --git a/src-tauri/src/shortcut/tauri_impl.rs b/src-tauri/src/shortcut/tauri_impl.rs
index ee249471..efeae567 100644
--- a/src-tauri/src/shortcut/tauri_impl.rs
+++ b/src-tauri/src/shortcut/tauri_impl.rs
@@ -183,6 +183,8 @@ mod tests {
"option+shift+space",
"ctrl+space",
"ctrl+shift+space",
+ "ctrl+alt+space",
+ "ctrl+alt+shift+space",
"alt+space",
"escape",
] {