diff --git a/Commands/OnboardCommand.cs b/Commands/OnboardCommand.cs index c4a163a..46afc8f 100644 --- a/Commands/OnboardCommand.cs +++ b/Commands/OnboardCommand.cs @@ -120,18 +120,29 @@ public static class OnboardCommand .UseConverter(c => c == "whisper-large-v3" ? "whisper-large-v3 (Accurate)" : "whisper-large-v3-turbo (Fast)")); } - config.WhisperLanguage = AnsiConsole.Prompt( - new TextPrompt("Microphone Spoken Language (e.g. en, es, zh):") - .DefaultValue(string.IsNullOrWhiteSpace(config.WhisperLanguage) ? "en" : config.WhisperLanguage) - .AllowEmpty() - .Validate(lang => - { - if (string.IsNullOrWhiteSpace(lang)) return ValidationResult.Success(); - if (lang.Contains(",") || lang.Contains(" ")) - return ValidationResult.Error("[red]Please provide only one language code (e.g., 'en' not 'en, es')[/]"); + var langChoice = AnsiConsole.Prompt( + new SelectionPrompt() + .Title("Select [green]Spoken Language[/] for Whisper:") + .AddChoices(new[] { "Auto-detect (multilingual)", "Specify language code" }) + .UseConverter(c => c)); + + if (langChoice == "Specify language code") + { + config.WhisperLanguage = AnsiConsole.Prompt( + new TextPrompt("Language code (e.g. en, es, zh, de):") + .DefaultValue(string.IsNullOrWhiteSpace(config.WhisperLanguage) ? "en" : config.WhisperLanguage) + .Validate(lang => + { + if (lang.Contains(",") || lang.Contains(" ")) + return ValidationResult.Error("[red]Please provide only one language code (e.g., 'en' not 'en, es')[/]"); + return ValidationResult.Success(); + })); + } + else + { + config.WhisperLanguage = string.Empty; + } - return ValidationResult.Success(); - })); var sessionType = Environment.GetEnvironmentVariable("XDG_SESSION_TYPE")?.ToLowerInvariant(); var typingBackends = sessionType == "wayland" ? new[] { "wtype", "wl-clipboard", "ydotool" } : new[] { "xdotool", "ydotool" }; diff --git a/IO/Injectors/WlClipboardTextInjector.cs b/IO/Injectors/WlClipboardTextInjector.cs index ae1ab98..8f8bd5c 100644 --- a/IO/Injectors/WlClipboardTextInjector.cs +++ b/IO/Injectors/WlClipboardTextInjector.cs @@ -6,9 +6,7 @@ namespace Toak.IO.Injectors; /// /// Text injector that writes text to the Wayland clipboard via wl-copy -/// and then pastes it using Shift+Insert via wtype. -/// Whitespace-only content is typed directly with wtype to avoid -/// wl-copy silently stripping leading/trailing spaces from clipboard content. +/// and then pastes it using Ctrl+V via wtype. /// public class WlClipboardTextInjector(INotifications notifications) : ITextInjector { @@ -39,11 +37,11 @@ public class WlClipboardTextInjector(INotifications notifications) : ITextInject Task.Delay(100).Wait(); - // Simulate Shift+Insert to paste into the focused window + // Simulate Ctrl+V to paste into the focused window var pasteInfo = new ProcessStartInfo { FileName = Constants.Commands.TypeWayland, - Arguments = "-M shift -k Insert -m shift", + Arguments = "-M ctrl -k v -m ctrl", UseShellExecute = false, CreateNoWindow = true }; @@ -91,11 +89,11 @@ public class WlClipboardTextInjector(INotifications notifications) : ITextInject await Task.Delay(100); - // Simulate Shift+Insert to paste into the focused window + // Simulate Ctrl+V to paste into the focused window var pasteInfo = new ProcessStartInfo { FileName = Constants.Commands.TypeWayland, - Arguments = "-M shift -k Insert -m shift", + Arguments = "-M ctrl -k v -m ctrl", UseShellExecute = false, CreateNoWindow = true };