keymap.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. Copyright 2018 Kenneth Aloysius
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. #include "action_layer.h"
  16. #include "../../backlight_staryu.h"
  17. enum layers {
  18. _LAYER0,
  19. _LAYER1,
  20. _LAYER2,
  21. _LAYER3
  22. };
  23. enum custom_keycodes {
  24. GIT_ADD = SAFE_RANGE,
  25. GIT_COMMIT,
  26. GIT_PUSH,
  27. MUTE,
  28. DEAFEN
  29. };
  30. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  31. if (record->event.pressed) {
  32. switch(keycode) {
  33. case GIT_ADD:
  34. SEND_STRING("git add ."SS_TAP(X_ENTER));
  35. break;
  36. case GIT_COMMIT:
  37. SEND_STRING("git commit -m "SS_DOWN(X_LSHIFT)SS_TAP(X_QUOTE)SS_UP(X_LSHIFT));
  38. break;
  39. case GIT_PUSH:
  40. SEND_STRING("git push"SS_TAP(X_ENTER));
  41. break;
  42. case MUTE:
  43. SEND_STRING(SS_LGUI(SS_LSFT("M")));
  44. break;
  45. case DEAFEN:
  46. SEND_STRING(SS_LGUI(SS_LSFT("D")));
  47. break;
  48. return false;
  49. }
  50. }
  51. return true;
  52. };
  53. #define _______ KC_TRNS
  54. #define XXXXXXX KC_NO
  55. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  56. [_LAYER0] = LAYOUT( \
  57. KC_ESC, TO(_LAYER1), \
  58. KC_Z, KC_X, KC_ENT \
  59. ),
  60. [_LAYER1] = LAYOUT( \
  61. MUTE, TO(_LAYER2), \
  62. GIT_ADD, GIT_COMMIT, GIT_PUSH \
  63. ),
  64. [_LAYER2] = LAYOUT( \
  65. RGB_MOD, TO(_LAYER3), \
  66. RGB_TOG, RGB_HUD, RGB_HUI \
  67. ),
  68. [_LAYER3] = LAYOUT( \
  69. RGB_VAI, TO(_LAYER0), \
  70. RGB_SAD, RGB_VAD, RGB_SAI \
  71. )
  72. };
  73. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
  74. return MACRO_NONE ;
  75. }
  76. void matrix_init_user(void) {
  77. for (int i=0; i<5; i++) {
  78. backlight_led_on(i);
  79. }
  80. }
  81. void matrix_scan_user(void) {
  82. }
  83. void led_set_user(uint8_t usb_led) {
  84. }