I use an external programmable keyboard (a keypad with QMK firmware) which allows me to get several layers with a few keys.
Is there a simple way to have all single keys intercepted by LuaMacros, and all the key combinations ignored?
For example, I program my keypad to send "F4" with the 1st key and "CTRL + F4" with the 2nd key.
I would like LuaMacros
to interpret only the "F4" alone to launch a software
and ignore the “CTRL- F4” which should be transmitted as is to the system
If I set a trigger for the whole keyboard, all the keys are blocked by LuaMacro and I am therefore obliged to code again all the key combinations to get them repeated.
I managed to know the CTRL key status with a variable that I set depending on whether the key is pressed or released
Code: Select all
lmc_set_handler('KeypadQMK',function(button, direction)
if (button == 17 and direction == 1) then -- CTRL DOWN
QctrlFlag = true
end
if (button == 17 and direction == 0) then -- CTRL UP
QctrlFlag = false
end
if (direction == 1) then return end -- ignore down
if (button == 115 and QctrlFlag == false) then
-- F4 detected
lmc_spawn("calc")
elseif (button == 115 and QctrlFlag == true) then
-- CTRL + F4 detected
lmc_send_keys('^{F4}')
else
print('not yet assigned: ' .. button)
end
end)
Something like this would be perfect :
Code: Select all
if (direction == 1) then return end -- ignore down
if (QctrlFlag == true or QaltFlag == true or QshiftFlag == true or QwinFlag == true) then
-- leave it as is and pass it to the computer
else
if (button == 115) then lmc_spawn("aaa")
if (button == 116) then lmc_spawn("bbb")
if (button == 117) then lmc_spawn("ccc")
end