keymap.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #include QMK_KEYBOARD_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. {
  11. _LAYER0,
  12. _LAYER1,
  13. _LAYER2
  14. };
  15. enum custom_keycodes
  16. {
  17. GIT_ADD = SAFE_RANGE,
  18. GIT_COMMIT,
  19. GIT_PUSH,
  20. MUTE,
  21. DEAFEN
  22. };
  23. bool process_record_user(uint16_t keycode, keyrecord_t *record)
  24. {
  25. if (record->event.pressed)
  26. {
  27. switch (keycode)
  28. {
  29. case GIT_ADD:
  30. SEND_STRING("git add ." SS_TAP(X_ENTER));
  31. break;
  32. case GIT_COMMIT:
  33. SEND_STRING("git commit -m " SS_DOWN(X_LSHIFT) SS_TAP(X_QUOTE) SS_UP(X_LSHIFT));
  34. break;
  35. case GIT_PUSH:
  36. SEND_STRING("git push" SS_TAP(X_ENTER));
  37. break;
  38. case MUTE:
  39. SEND_STRING(SS_LGUI(SS_LSFT("M")));
  40. break;
  41. case DEAFEN:
  42. SEND_STRING(SS_LGUI(SS_LSFT("D")));
  43. break;
  44. return false;
  45. }
  46. }
  47. return true;
  48. };
  49. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  50. [_LAYER0] = LAYOUT(
  51. MUTE, DEAFEN, TO(_LAYER1),
  52. GIT_ADD, GIT_COMMIT, GIT_PUSH),
  53. [_LAYER1] = LAYOUT(
  54. KC_VOLD, KC_VOLU, TO(_LAYER2),
  55. KC_MRWD, KC_MPLY, KC_MNXT),
  56. [_LAYER2] = LAYOUT(
  57. KC_ESC, KC_UP, TO(_LAYER0),
  58. KC_Z, KC_X, KC_SPACE)};
  59. void matrix_init_user(void)
  60. {
  61. #ifdef BACKLIGHT_ENABLE
  62. backlight_level(0);
  63. #endif
  64. }