You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.6 KiB

  1. # Mousekeys
  2. Mousekeys is a feature that allows you to emulate a mouse using your keyboard. You can move the pointer around, click up to 5 buttons, and even scroll in all 4 directions. QMK uses the same algorithm as the X Window System MouseKeysAccel feature. You can read more about it [on Wikipedia](https://en.wikipedia.org/wiki/Mouse_keys).
  3. ## Adding Mousekeys to a Keymap
  4. There are two steps to adding Mousekeys support to your keyboard. You must enable support in the Makefile and you must map mouse actions to keys on your keyboard.
  5. ### Adding Mousekeys Support in the `Makefile`
  6. To add support for Mousekeys you simply need to add a single line to your keymap's `Makefile`:
  7. ```
  8. MOUSEKEY_ENABLE = yes
  9. ```
  10. You can see an example here: https://github.com/qmk/qmk_firmware/blob/master/keyboards/clueboard/keymaps/mouse_keys/Makefile
  11. ### Mapping Mouse Actions to Keyboard Keys
  12. You can use these keycodes within your keymap to map button presses to mouse actions:
  13. |Key |Aliases |Description |
  14. |----------------|---------|---------------------------|
  15. |`KC_MS_UP` |`KC_MS_U`|Mouse Cursor Up |
  16. |`KC_MS_DOWN` |`KC_MS_D`|Mouse Cursor Down |
  17. |`KC_MS_LEFT` |`KC_MS_L`|Mouse Cursor Left |
  18. |`KC_MS_RIGHT` |`KC_MS_R`|Mouse Cursor Right |
  19. |`KC_MS_BTN1` |`KC_BTN1`|Mouse Button 1 |
  20. |`KC_MS_BTN2` |`KC_BTN2`|Mouse Button 2 |
  21. |`KC_MS_BTN3` |`KC_BTN3`|Mouse Button 3 |
  22. |`KC_MS_BTN4` |`KC_BTN4`|Mouse Button 4 |
  23. |`KC_MS_BTN5` |`KC_BTN5`|Mouse Button 5 |
  24. |`KC_MS_WH_UP` |`KC_WH_U`|Mouse Wheel Up |
  25. |`KC_MS_WH_DOWN` |`KC_WH_D`|Mouse Wheel Down |
  26. |`KC_MS_WH_LEFT` |`KC_WH_L`|Mouse Wheel Left |
  27. |`KC_MS_WH_RIGHT`|`KC_WH_R`|Mouse Wheel Right |
  28. |`KC_MS_ACCEL0` |`KC_ACL0`|Set mouse acceleration to 0|
  29. |`KC_MS_ACCEL1` |`KC_ACL1`|Set mouse acceleration to 1|
  30. |`KC_MS_ACCEL2` |`KC_ACL2`|Set mouse acceleration to 2|
  31. You can see an example in the `_ML` here: https://github.com/qmk/qmk_firmware/blob/master/keyboards/clueboard/keymaps/mouse_keys/keymap.c#L46
  32. ## Configuring the Behavior of Mousekeys
  33. The default speed for controlling the mouse with the keyboard is intentionally slow. You can adjust these parameters by adding these settings to your keymap's `config.h` file. All times are specified in milliseconds (ms).
  34. ```
  35. #define MOUSEKEY_DELAY 300
  36. #define MOUSEKEY_INTERVAL 50
  37. #define MOUSEKEY_MAX_SPEED 10
  38. #define MOUSEKEY_TIME_TO_MAX 20
  39. #define MOUSEKEY_WHEEL_MAX_SPEED 8
  40. #define MOUSEKEY_WHEEL_TIME_TO_MAX 40
  41. ```
  42. ### `MOUSEKEY_DELAY`
  43. When one of the mouse movement buttons is pressed this setting is used to define the delay between that button press and the mouse cursor moving. Some people find that small movements are impossible if this setting is too low, while settings that are too high feel sluggish.
  44. ### `MOUSEKEY_INTERVAL`
  45. When a movement key is held down this specifies how long to wait between each movement report. Lower settings will translate into an effectively higher mouse speed.
  46. ### `MOUSEKEY_MAX_SPEED`
  47. As a movement key is held down the speed of the mouse cursor will increase until it reaches `MOUSEKEY_MAX_SPEED`.
  48. ### `MOUSEKEY_TIME_TO_MAX`
  49. How long you want to hold down a movement key for until `MOUSEKEY_MAX_SPEED` is reached. This controls how quickly your cursor will accelerate.
  50. ### `MOUSEKEY_WHEEL_MAX_SPEED`
  51. The top speed for scrolling movements.
  52. ### `MOUSEKEY_WHEEL_TIME_TO_MAX`
  53. How long you want to hold down a scroll key for until `MOUSEKEY_WHEEL_MAX_SPEED` is reached. This controls how quickly your scrolling will accelerate.