fixed weird option behaviour with corne specific mouse drags

This commit is contained in:
2026-08-16 11:27:21 +01:00
parent b4426becc4
commit c853222bde

View File

@@ -164,32 +164,44 @@ local globalAppBinds = {
{ mod = subMod, key = { "SHIFT + mouse:272" }, dispatch = hl.dsp.window.resize(), opts = { mouse = true } }, { mod = subMod, key = { "SHIFT + mouse:272" }, dispatch = hl.dsp.window.resize(), opts = { mouse = true } },
} }
-- function to merge lists
local function merge_into(first, second)
for index, item in pairs(second) do
first[index] = item
end
return first
end
-- Workspace switch keys -- Workspace switch keys
for _, bind in ipairs(globalAppBinds) do for _, bind in ipairs(globalAppBinds) do
-- Mod specified or default modifier
local modBind = bind.mod or mainMod local modBind = bind.mod or mainMod
local command local command
-- If the dispatcher isnt a string evaluate
-- it as a command
if type(bind.dispatch) ~= "string" then if type(bind.dispatch) ~= "string" then
command = bind.dispatch command = bind.dispatch
else else
command = hl.dsp.exec_cmd(bind.dispatch) command = hl.dsp.exec_cmd(bind.dispatch)
end end
-- If there are options then apply them
local opts = {} local opts = {}
if bind.opts then if bind.opts then
opts = bind.opts opts = bind.opts
end end
-- If there is a specific key for that device then
-- bind it, else bind the default key
if bind.key[keybindIndex] then if bind.key[keybindIndex] then
hl.bind(modBind .. bind.key[keybindIndex], command, opts) hl.bind(modBind .. bind.key[keybindIndex], command, opts)
else else
hl.bind(modBind .. bind.key[1], command) hl.bind(modBind .. bind.key[1], command)
end end
-- If not on hackstation -- If corne keys not being bound by default, then bind them just in case
-- Bind all keys for corne if it connects because theres no number row
if keybindIndex ~= 1 then if keybindIndex ~= 1 then
hl.bind( local deviceSpecifier = { device = { inclusive = true, list = { "zmk-project-corne-keyboard" } } }
"SUPER + " .. bind.key[1], -- Apply options so that dragging windows and stuff works
command, local corneOptions = merge_into(opts, deviceSpecifier)
{ device = { inclusive = true, list = { "zmk-project-corne-keyboard" } } } hl.bind("SUPER + " .. bind.key[1], command, corneOptions)
)
end end
end end
@@ -205,8 +217,8 @@ for index, bind in ipairs(keyboardSplit) do
hl.bind(mainMod .. "SHIFT + " .. bind, hl.dsp.window.move({ workspace = index, follow = false })) hl.bind(mainMod .. "SHIFT + " .. bind, hl.dsp.window.move({ workspace = index, follow = false }))
end end
-- Workspace binds for corne in particular -- If corne keys not being bound
if Hostname ~= "HACKSTATION" then if keybindIndex ~= 1 then
local corneKeyboardSplit = {} local corneKeyboardSplit = {}
for char in corneKeyboardString:gmatch(".") do for char in corneKeyboardString:gmatch(".") do