oneshot.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #define ENABLE_ONESHOT
  2. #ifdef ENABLE_ONESHOT
  3. #pragma once
  4. typedef enum {
  5. ONESHOT_LCTL = 0,
  6. ONESHOT_LSFT = 1,
  7. ONESHOT_LALT = 2,
  8. ONESHOT_LGUI = 3,
  9. ONESHOT_RCTL = 4,
  10. ONESHOT_RSFT = 5,
  11. ONESHOT_RALT = 6,
  12. ONESHOT_RGUI = 7,
  13. ONESHOT_NONE = 8,
  14. ONESHOT_MOD_COUNT = 8,
  15. } oneshot_mod;
  16. // This function should be called inside proces_record_user and does everything needed to get one shot modifiers working.
  17. // Returns true if the keycode needs further handling, false otherwise.
  18. int8_t update_oneshot_modifiers(uint16_t keycode, keyrecord_t *record, int8_t keycode_consumed);
  19. int8_t turnoff_oneshot_modifiers(void);
  20. // TO BE IMPLEMENTED BY THE USER
  21. // This function should return one of the oneshot_mod enumerations (see keymap.c implementation)
  22. oneshot_mod get_modifier_for_trigger_key(uint16_t keycode);
  23. // TO BE IMPLEMENTED BY THE USER
  24. // This function should return true for keycodes that must be ignored in the oneshot modifier behaviour.
  25. // You probably want to ignore layer keys. Trigger keys don't need to be specified here.
  26. bool is_oneshot_modifier_ignored_key(uint16_t keycode);
  27. // TO BE IMPLEMENTED BY THE USER
  28. // This function should return true for keycodes that should reset all oneshot modifiers.
  29. bool is_oneshot_modifier_cancel_key(uint16_t keycode);
  30. #endif