From 1e7391d0dc32869714c76d9dbaebc44cf1a13e28 Mon Sep 17 00:00:00 2001 From: husamemad Date: Thu, 30 Jul 2026 21:54:07 +0300 Subject: [PATCH] Detect terminal windows by client process, not app-id Omarchy launches its own TUIs through xdg-terminal-exec with app-ids such as org.omarchy.btop, org.omarchy.terminal and TUI.float, so they never match the terminal class list even though the client is a terminal. Universal copy then sent CTRL+C instead of CTRL+Insert, and the TUI took it as SIGINT and closed. Keep the class check and fall back to the client process name, which identifies the terminal regardless of the app-id it was given. --- default/hypr/bindings/clipboard.lua | 40 +++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/default/hypr/bindings/clipboard.lua b/default/hypr/bindings/clipboard.lua index ce70fe4635..aac1a7d224 100644 --- a/default/hypr/bindings/clipboard.lua +++ b/default/hypr/bindings/clipboard.lua @@ -23,13 +23,49 @@ local terminal_classes = { wezterm = true, } +-- Omarchy launches its own TUIs through xdg-terminal-exec with app-ids such as +-- org.omarchy.btop, org.omarchy.terminal and TUI.float, so the window class +-- never matches the list above even though the client is a terminal. Fall back +-- to the client process, which names the terminal regardless of the app-id. +local terminal_processes = { + alacritty = true, + foot = true, + footclient = true, + ghostty = true, + kitty = true, + wezterm = true, + ["wezterm-gui"] = true, +} + +local function client_process_name(pid) + if not pid or pid <= 0 then + return nil + end + + local file = io.open("/proc/" .. pid .. "/comm", "r") + if not file then + return nil + end + + local name = file:read("*l") + file:close() + + return name +end + local function active_window_is_terminal() local window = hl.get_active_window() - if not window or not window.class then + if not window then return false end - return terminal_classes[window.class:lower()] == true + if window.class and terminal_classes[window.class:lower()] == true then + return true + end + + local process = client_process_name(window.pid) + + return process ~= nil and terminal_processes[process:lower()] == true end local function universal_clipboard_shortcut(default_mods, default_key, terminal_mods, terminal_key)