Remap laptop internal keys
Posted: 26 Aug 2021, 01:01
Hello there,
I need some help remapping laptop keys.
Here is my scenario: I have a Microsoft Surface with type cover, I want to keep F1-F8 intact and swap F9 with "Home", F10 with "End", F11 with "PgUp" and F12 with "PgDn". Follow quistart.lua I got following code, however, it has two issues:
1. I cannot use any other key, how can I bypass luamacros for other keys?
2. It seems following code doesn't works for F9-F12, I got some strange results, it seems anther key is sent afterwards.
Your help is greatly appreciated.
I need some help remapping laptop keys.
Here is my scenario: I have a Microsoft Surface with type cover, I want to keep F1-F8 intact and swap F9 with "Home", F10 with "End", F11 with "PgUp" and F12 with "PgDn". Follow quistart.lua I got following code, however, it has two issues:
1. I cannot use any other key, how can I bypass luamacros for other keys?
2. It seems following code doesn't works for F9-F12, I got some strange results, it seems anther key is sent afterwards.
Your help is greatly appreciated.
Code: Select all
lmc_device_set_name('SurfaceCover', "ID_09C0") -- substitute the ID you have found here
lmc_set_handler('SurfaceCover',function(button, direction)
if (direction == 1) then return end -- ignore down;
if (button == 120) then lmc_send_keys('{HOME}')
elseif (button == 121) then lmc_send_keys('{END}')
elseif (button == 122) then lmc_send_keys('{PGUP}')
elseif (button == 123) then lmc_send_keys('{PGDN}')
elseif (button == 36) then lmc_send_keys('{F9}')
elseif (button == 35) then lmc_send_keys('{F10}')
elseif (button == 33) then lmc_send_keys('{F11}')
elseif (button == 34) then lmc_send_keys('{F12}')
else print('Not yet assigned: ' .. button)
end
end)