A free, open source, and extensible speech-to-text application that works completely offline.
fix: skip wtype on GNOME Wayland for clipboard paste (#1276)
Sean McClearyc7a68feddb9f
diff --git a/src-tauri/src/clipboard.rs b/src-tauri/src/clipboard.rsindex c1964481..ed6066f0 100644--- a/src-tauri/src/clipboard.rs+++ b/src-tauri/src/clipboard.rs@@ -12,7 +12,7 @@ use tauri::{AppHandle, Manager};use tauri_plugin_clipboard_manager::ClipboardExt;#[cfg(target_os = "linux")]-use crate::utils::{is_kde_wayland, is_wayland};+use crate::utils::{is_gnome_wayland, is_kde_wayland, is_wayland};fn with_enigo<T>(app_handle: &AppHandle,@@ -122,9 +122,11 @@ fn paste_via_clipboard(#[cfg(target_os = "linux")]fn try_send_key_combo_linux(paste_method: &PasteMethod) -> Result<bool, String> {if is_wayland() {- // Wayland: prefer wtype (but not on KDE), then dotool, then ydotool+ // Wayland: prefer wtype (but not on KDE or GNOME), then dotool, then ydotool// Note: wtype doesn't work on KDE (no zwp_virtual_keyboard_manager_v1 support)- if !is_kde_wayland() && is_wtype_available() {+ // or on GNOME/Mutter (same reason — Mutter deliberately does not implement+ // the virtual-keyboard-v1 protocol).+ if !is_kde_wayland() && !is_gnome_wayland() && is_wtype_available() {info!("Using wtype for key combo");send_key_combo_via_wtype(paste_method)?;return Ok(true);@@ -205,7 +207,9 @@ fn try_direct_typing_linux(text: &str, preferred_tool: TypingTool) -> Result<boo}// Wayland: prefer wtype, then dotool, then ydotool// Note: wtype doesn't work on KDE (no zwp_virtual_keyboard_manager_v1 support)- if !is_kde_wayland() && is_wtype_available() {+ // or on GNOME/Mutter (same reason — Mutter deliberately does not implement+ // the virtual-keyboard-v1 protocol).+ if !is_kde_wayland() && !is_gnome_wayland() && is_wtype_available() {info!("Using wtype for direct text input");type_text_via_wtype(text)?;return Ok(true);diff --git a/src-tauri/src/utils.rs b/src-tauri/src/utils.rsindex e7a206e2..d62cc460 100644--- a/src-tauri/src/utils.rs+++ b/src-tauri/src/utils.rs@@ -137,6 +137,20 @@ pub fn is_kde_wayland() -> bool {is_wayland() && is_kde_plasma()}+/// Check if running on GNOME desktop environment+#[cfg(target_os = "linux")]+pub fn is_gnome() -> bool {+ std::env::var("XDG_CURRENT_DESKTOP")+ .map(|v| v.to_uppercase().contains("GNOME"))+ .unwrap_or(false)+}++/// Check if running on GNOME with Wayland+#[cfg(target_os = "linux")]+pub fn is_gnome_wayland() -> bool {+ is_wayland() && is_gnome()+}+#[cfg(test)]mod tests {use super::*;