Mouse keys

To enable mouse cursor and/or mouse buttons control from the keyboard add this module to list:

from kmk.modules.mouse_keys import MouseKeys
keyboard.modules.append(MouseKeys())

Keycodes

KeycodeDescription
KC.MB_LMBLeft mouse button
KC.MB_RMBRight mouse button
KC.MB_MMBMiddle mouse button
KC.MB_BTN4mouse button 4
KC.MB_BTN5mouse button 5
KC.MW_UPMouse wheel up
KC.MW_DOWN, KC.MW_DNMouse wheel down
KC.MW_LEFT, KC.MW_LTMouse pan left
KC.MW_RIGHT, KC.MW_RTMouse pan right
KC.MS_UPMove mouse cursor up
KC.MS_DOWN, KC.MS_DNMove mouse cursor down
KC.MS_LEFT, KC.MS_LTMove mouse cursor left
KC.MS_RIGHT, KC.MS_RTMove mouse cursor right

Customizing Movement

To change the speed and acceleration of mouse movement use the following code:

from kmk.modules.mouse_keys import MouseKeys

mousekeys = MouseKeys(
    max_speed = 10,
    acc_interval = 20, # Delta ms to apply acceleration
    move_step = 1
)

keyboard.modules.append(mousekeys)

Note: Support for panning (mouse wheel left/right) boot.py has to be explicitly enabled in boot.py with the bootcfg module.