Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion default/hypr/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ function o.preinstalled_bindings_enabled()
return not file_exists((os.getenv("HOME") or "") .. "/.local/state/omarchy/preinstalls-removed")
end

local function bind_dedup_key(keys, options)
if not options then
return keys
end

-- Internal dedup key: same keys with a different event type
if options.release then
return keys .. "|r"
elseif options.long_press then
return keys .. "|l"
end

return keys
end

local registered = {}

function o.bind(keys, description, dispatcher, options)
local opts = options or {}

Expand All @@ -75,8 +92,16 @@ function o.bind(keys, description, dispatcher, options)
end

dispatcher = command_from(dispatcher, description)
local disp_is_launch = type(dispatcher) == "string"
local dedup = bind_dedup_key(keys, options)

if registered[dedup] ~= nil and (disp_is_launch or registered[dedup]) then
hl.unbind(keys)
end

registered[dedup] = disp_is_launch
Comment thread
felixzsh marked this conversation as resolved.

if type(dispatcher) == "string" then
if disp_is_launch then
dispatcher = hl.dsp.exec_cmd(dispatcher)
end

Expand Down