diff --git a/default/hypr/apps/terminals.lua b/default/hypr/apps/terminals.lua index 4d90a636..85629187 100644 --- a/default/hypr/apps/terminals.lua +++ b/default/hypr/apps/terminals.lua @@ -1,3 +1,3 @@ -- Define terminal tag to style them uniformly. -o.window("(Alacritty|kitty|com.mitchellh.ghostty|foot)", { tag = "+terminal" }) +o.window("(Alacritty|kitty|com.mitchellh.ghostty|foot|wezterm)", { tag = "+terminal" }) o.window({ tag = "terminal" }, { tag = "-default-opacity", opacity = "0.97 0.9" }) diff --git a/default/hypr/bindings/clipboard.lua b/default/hypr/bindings/clipboard.lua index 2f4d1331..10a2f6df 100644 --- a/default/hypr/bindings/clipboard.lua +++ b/default/hypr/bindings/clipboard.lua @@ -10,7 +10,34 @@ local function send_shortcut_once(mods, key) end end -o.bind("SUPER + C", "Universal copy", send_shortcut_once("CTRL", "Insert")) -o.bind("SUPER + V", "Universal paste", send_shortcut_once("SHIFT", "Insert")) +local terminal_classes = { + alacritty = true, + ["com.mitchellh.ghostty"] = true, + foot = true, + kitty = true, + wezterm = true, +} + +local function active_window_is_terminal() + local window = hl.get_active_window() + if not window or not window.class then + return false + end + + return terminal_classes[window.class:lower()] == true +end + +local function universal_clipboard_shortcut(default_mods, default_key, terminal_mods, terminal_key) + return function() + if active_window_is_terminal() then + send_shortcut_once(terminal_mods, terminal_key)() + else + send_shortcut_once(default_mods, default_key)() + end + end +end + +o.bind("SUPER + C", "Universal copy", universal_clipboard_shortcut("CTRL", "C", "CTRL", "Insert")) +o.bind("SUPER + V", "Universal paste", universal_clipboard_shortcut("CTRL", "V", "SHIFT", "Insert")) o.bind("SUPER + X", "Universal cut", send_shortcut_once("CTRL", "X")) o.bind("SUPER + CTRL + V", "Clipboard manager", "omarchy-shell shell toggle omarchy.clipboard")