-- Define callback for whole device
lmc_set_handler('MACROS', function(button, direction)
if (direction == 1) then return end -- ignore key down events
if (button == 13) then -- Enter key on numpad
switchLayer()
else
local action = layers[currentLayer][string.char(button)]
if action then
action()
else
print('Not yet assigned: ' .. string.char(button))
end
end
end)
-- Function to switch to the next layer
function switchLayer()
currentLayer = currentLayer % #layers + 1
print('Switched to layer ' .. currentLayer)
end
Not an issue but maybe a lifesaver :)
-- Assign logical name to macro keyboard lmc_assign_keyboard('MACROS')
-- Define current active layer local currentLayer = 1
-- Define keybindings for each layer local layers = { { -- Layer 1: Default layer ['A'] = function() lmc_spawn("C:/Path/To/Application.exe") end, ['B'] = function() lmc_spawn("C:/Another/Path/To/Application.exe") end, ['C'] = function() lmc_spawn("C:/Yet/Another/Path/To/Application.exe") end, ['D'] = function() lmc_spawn("C:/One/More/Path/To/Application.exe") end, }, { -- Layer 2: Secondary layer ['E'] = function() lmc_spawn("C:/Path/To/Application.exe") end, ['F'] = function() lmc_spawn("C:/Another/Path/To/Application.exe") end, ['G'] = function() lmc_spawn("C:/Yet/Another/Path/To/Application.exe") end, ['H'] = function() lmc_spawn("C:/One/More/Path/To/Application.exe") end, }, }
-- Define callback for whole device lmc_set_handler('MACROS', function(button, direction) if (direction == 1) then return end -- ignore key down events
end)
-- Function to switch to the next layer function switchLayer() currentLayer = currentLayer % #layers + 1 print('Switched to layer ' .. currentLayer) end