Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix(linux): paste text into Omarchy agent terminals (#2907)
Houston Searcy68367bf50352
diff --git a/resources/linux-fast-paste.c b/resources/linux-fast-paste.cindex 1d528ef70..c652579eb 100644--- a/resources/linux-fast-paste.c+++ b/resources/linux-fast-paste.c@@ -386,6 +386,11 @@ static int contains_terminal_name(const char *wm_class, const char *name) {static int is_terminal(const char *wm_class) {if (!wm_class) return 0;+ /* Omarchy assigns terminal-launched apps their own IDs. Keep in sync with+ * OMARCHY_TERMINAL_PREFIXES in src/helpers/clipboard.js. */+ if (strncasecmp(wm_class, "org.omarchy.", strlen("org.omarchy.")) == 0 ||+ strncasecmp(wm_class, "tui.", strlen("tui.")) == 0)+ return 1;for (int i = 0; terminal_classes[i]; i++) {if (contains_terminal_name(wm_class, terminal_classes[i]))return 1;diff --git a/src/helpers/clipboard.js b/src/helpers/clipboard.jsindex aba17dbf8..74a12c215 100644--- a/src/helpers/clipboard.js+++ b/src/helpers/clipboard.js@@ -77,6 +77,15 @@ const LINUX_TERMINAL_CLASSES = [// is harmless — no such window class exists there.const TERMINAL_SIGNATURES = [...LINUX_TERMINAL_CLASSES, "iterm"];+// Omarchy gives terminal-launched apps their own IDs instead of the emulator's+// class. Keep these prefixes in sync with resources/linux-fast-paste.c.+const OMARCHY_TERMINAL_PREFIXES = ["org.omarchy.", "tui."];++function isOmarchyTerminalSignature(signature) {+ const normalized = String(signature || "").toLowerCase();+ return OMARCHY_TERMINAL_PREFIXES.some((prefix) => normalized.startsWith(prefix));+}+function writeClipboardInRenderer(webContents, text) {if (!webContents || !webContents.executeJavaScript) {return Promise.reject(new Error("Invalid webContents for clipboard write"));@@ -270,6 +279,7 @@ class ClipboardManager {// match inside unrelated names ("com.system76.CosmicEdit"), so it must be a whole word.isTerminalSignature(signature) {if (!signature) return false;+ if (isOmarchyTerminalSignature(signature)) return true;const normalized = String(signature).toLowerCase();const words = normalized.split(/[^a-z0-9]+/);return TERMINAL_SIGNATURES.some((term) =>@@ -1718,6 +1728,8 @@ class ClipboardManager {// COSMIC names the focused app but not its process, so Electron apps look like any// other window there: only a known terminal leaves Shift+Insert.const useShiftInsert =+ // Match Omarchy's universal terminal paste, including Codex and Claude.+ windowSignals.some(isOmarchyTerminalSignature) ||detectedIsKonsole ||detectedIsElectron ||(isWayland && (windowSignals.length === 0 || (isCosmic && !isTerminalTarget)));diff --git a/test/helpers/clipboardRestore.test.js b/test/helpers/clipboardRestore.test.jsindex f08b004c1..3432d610d 100644--- a/test/helpers/clipboardRestore.test.js+++ b/test/helpers/clipboardRestore.test.js@@ -598,6 +598,44 @@ test("Hyprland prefers wtype over sendshortcut when installed", async () => {);});+for (const windowClass of ["org.omarchy.agent", "org.omarchy.btop", "TUI.float"]) {+ test(`Hyprland pastes text with Shift+Insert into ${windowClass}`, async () => {+ const spawnCalls = [];+ const Manager = loadClipboardManager({ spawn: createSpawn(spawnCalls, [0]) });+ const manager = new Manager();+ manager.commandExists = (command) => command === "hyprctl" || command === "wtype";+ manager.resolveLinuxFastPasteBinary = () => null;+ manager._detectHyprlandWindowClass = () => windowClass;++ await withWaylandEnvironment("Hyprland", () => manager.pasteLinux(null));++ assert.deepEqual(spawnCalls, [+ { command: "wtype", args: ["-M", "shift", "-k", "Insert", "-m", "shift"] },+ ]);+ });+}++test("Hyprland keeps the Omarchy text paste shortcut when wtype fails", async () => {+ const spawnCalls = [];+ const Manager = loadClipboardManager({+ spawn: createSpawn(spawnCalls, [1, 0], { stdout: ["", "ok\n"] }),+ });+ const manager = new Manager();+ manager.commandExists = (command) => command === "hyprctl" || command === "wtype";+ manager.resolveLinuxFastPasteBinary = () => null;+ manager._detectHyprlandWindowClass = () => "org.omarchy.agent";++ await withWaylandEnvironment("Hyprland", () => manager.pasteLinux(null));++ assert.deepEqual(spawnCalls[1], {+ command: "hyprctl",+ args: [+ "dispatch",+ 'hl.dsp.send_shortcut({ mods = "SHIFT", key = "Insert", window = "activewindow" })',+ ],+ });+});+test("failed wtype on Hyprland continues to sendshortcut", async () => {const spawnCalls = [];const TestClipboardManager = loadClipboardManager({diff --git a/test/helpers/linuxTerminalClasses.test.js b/test/helpers/linuxTerminalClasses.test.jsindex e7b4d1fb3..45bf23c0c 100644--- a/test/helpers/linuxTerminalClasses.test.js+++ b/test/helpers/linuxTerminalClasses.test.js@@ -63,3 +63,13 @@ test("ordinary GUI apps are not terminals", () => {assert.equal(clipboard.isLinuxTerminalWindowClass(""), false);assert.equal(clipboard.isLinuxTerminalWindowClass(null), false);});++test("Omarchy terminal app IDs match their prefixes case-insensitively", () => {+ const clipboard = new ClipboardManager();+ for (const signature of ["org.omarchy.agent", "org.omarchy.btop", "TUI.float"]) {+ assert.equal(clipboard.isLinuxTerminalWindowClass(signature), true, signature);+ }+ for (const signature of ["com.example.org.omarchy.editor", "com.example.tui.editor"]) {+ assert.equal(clipboard.isLinuxTerminalWindowClass(signature), false, signature);+ }+});