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.

75 lines
2.0 KiB

  1. // TODO: Improve this currently there is no feedback if activated by other means.
  2. bool CAPS_LOCK = false;
  3. bool NUM_LOCK = false;
  4. bool SCROLL_LOCK = false;
  5. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  6. if (!process_record_dynamic_macro(keycode, record)) {
  7. return false;
  8. }
  9. switch (keycode) {
  10. case KC_CAPS_LOCK:
  11. if (record->event.pressed) {
  12. if (!(CAPS_LOCK)) {
  13. ergodox_right_led_1_on();
  14. CAPS_LOCK = true;
  15. } else {
  16. ergodox_right_led_1_off();
  17. CAPS_LOCK = false;
  18. }
  19. }
  20. return true;
  21. case KC_NLCK:
  22. if (record->event.pressed) {
  23. if (!(NUM_LOCK)) {
  24. ergodox_right_led_2_on();
  25. NUM_LOCK = true;
  26. } else {
  27. ergodox_right_led_2_off();
  28. NUM_LOCK = false;
  29. }
  30. }
  31. return true;
  32. case KC_SLCK:
  33. if (record->event.pressed) {
  34. if (!(SCROLL_LOCK)) {
  35. ergodox_right_led_3_on();
  36. SCROLL_LOCK = true;
  37. } else {
  38. ergodox_right_led_3_off();
  39. SCROLL_LOCK = false;
  40. }
  41. }
  42. return true;
  43. case KC_MS_WH_UP ... KC_MS_WH_RIGHT:
  44. if (record->event.pressed) {
  45. if (SCROLL_LOCK) {
  46. return false;
  47. } else {
  48. return true;
  49. }
  50. }
  51. case MY_CUSTOM_MACRO:
  52. if (record->event.pressed) {
  53. SEND_STRING("QMK is the best thing ever!"); // this is our macro!
  54. return false;
  55. }
  56. case MY_OTHER_MACRO:
  57. if (record->event.pressed) {
  58. SEND_STRING(SS_LCTRL("ac")); // selects all and copies
  59. return false;
  60. }
  61. default:
  62. return true;
  63. }
  64. }