Keep universal clipboard shortcuts working in terminals
Sending the shortcut through wtype's virtual keyboard let the physically held SUPER merge into the injected chord, so terminals saw SUPER+CTRL+Insert instead of CTRL+Insert, and injected CTRL+V could even trigger the SUPER+CTRL+V clipboard manager bind. Send via send_key_state with no window target instead: explicit mods go straight to the focused surface, layer-shell panels included. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XnMDbwJXQA3fvW8o8Pwr97
This commit is contained in:
co-authored by
Claude Fable 5
parent
63955e787f
commit
a0e6d65ba8
@@ -1,10 +1,17 @@
|
||||
-- Send through the virtual keyboard so universal clipboard shortcuts reach
|
||||
-- both normal windows and focused layer-shell surfaces such as Omarchy panels.
|
||||
-- Hyprland's send_key_state with window = "activewindow" cannot target layers.
|
||||
-- Send with explicit mods to the focused surface by omitting the window target,
|
||||
-- so universal clipboard shortcuts reach both normal windows and focused
|
||||
-- layer-shell surfaces such as Omarchy panels. A virtual keyboard (wtype) won't
|
||||
-- do: the physically held SUPER merges into the injected chord at the seat.
|
||||
-- The down/up split works around Hyprland send_shortcut sometimes leaving
|
||||
-- synthetic key state stuck/repeating.
|
||||
-- https://github.com/hyprwm/Hyprland/discussions/14099
|
||||
local function send_shortcut_once(mods, key)
|
||||
return function()
|
||||
local modifier = mods:lower()
|
||||
hl.dispatch(hl.dsp.exec_cmd("wtype -M " .. modifier .. " -k " .. key:lower() .. " -m " .. modifier))
|
||||
hl.dispatch(hl.dsp.send_key_state({ mods = mods, key = key, state = "down" }))
|
||||
|
||||
hl.timer(function()
|
||||
hl.dispatch(hl.dsp.send_key_state({ mods = mods, key = key, state = "up" }))
|
||||
end, { timeout = 50, type = "oneshot" })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user