keymap.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "../../m6_a.h"
  2. #include "action_layer.h"
  3. #include "eeconfig.h"
  4. extern keymap_config_t keymap_config;
  5. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  6. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  7. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  8. // entirely and just use numbers.
  9. enum layers {
  10. _LAYER0,
  11. _LAYER1,
  12. _LAYER2
  13. };
  14. enum custom_keycodes {
  15. GIT_ADD = SAFE_RANGE,
  16. GIT_COMMIT,
  17. GIT_PUSH,
  18. MUTE,
  19. DEAFEN
  20. };
  21. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  22. if (record->event.pressed) {
  23. switch(keycode) {
  24. case GIT_ADD:
  25. SEND_STRING("git add ."SS_TAP(X_ENTER));
  26. break;
  27. case GIT_COMMIT:
  28. SEND_STRING("git commit -m "SS_DOWN(X_LSHIFT)SS_TAP(X_QUOTE)SS_UP(X_LSHIFT));
  29. break;
  30. case GIT_PUSH:
  31. SEND_STRING("git push"SS_TAP(X_ENTER));
  32. break;
  33. case MUTE:
  34. SEND_STRING(SS_LGUI(SS_LSFT("M")));
  35. break;
  36. case DEAFEN:
  37. SEND_STRING(SS_LGUI(SS_LSFT("D")));
  38. break;
  39. return false;
  40. }
  41. }
  42. return true;
  43. };
  44. #define _______ KC_TRNS
  45. #define XXXXXXX KC_NO
  46. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  47. [_LAYER0] = KEYMAP(
  48. MUTE, DEAFEN, TO(_LAYER1),
  49. GIT_ADD, GIT_COMMIT, GIT_PUSH
  50. ),
  51. [_LAYER1] = KEYMAP(
  52. KC_VOLD, KC_VOLU, TO(_LAYER2),
  53. KC_MRWD, KC_MPLY, KC_MNXT
  54. ),
  55. [_LAYER2] = KEYMAP(
  56. KC_ESC, KC_UP, TO(_LAYER0),
  57. KC_Z, KC_X, KC_SPACE
  58. )
  59. };
  60. void matrix_init_user(void) {
  61. #ifdef BACKLIGHT_ENABLE
  62. backlight_level(0);
  63. #endif
  64. }