logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (2245B)


  1. /* Copyright 2020 Jose I. Martinez
  2. *
  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. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include QMK_KEYBOARD_H
  17. // Defines names for use in layer keycodes and the keymap
  18. enum layer_names {
  19. _BASE,
  20. _FN
  21. };
  22. // Defines the keycodes used by our macros in process_record_user
  23. enum custom_keycodes {
  24. GITSTTS = SAFE_RANGE,
  25. GITPULL,
  26. GITPUSH,
  27. GITCOM
  28. };
  29. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  30. /* Base */
  31. [_BASE] = LAYOUT(
  32. KC_ESCAPE, KC_HOME, KC_DEL,
  33. MO(_FN) , KC_UP , KC_ENTER,
  34. KC_LEFT , KC_DOWN, KC_RIGHT
  35. ),
  36. [_FN] = LAYOUT(
  37. KC_TRNS, GITCOM, GITPUSH,
  38. KC_TRNS, GITSTTS, GITPULL,
  39. KC_TRNS, KC_TRNS, KC_TRNS
  40. )
  41. };
  42. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  43. switch (keycode) {
  44. case GITSTTS:
  45. if (record->event.pressed) {
  46. // when keycode GITSTTS is pressed
  47. SEND_STRING("git status");
  48. }
  49. break;
  50. case GITPULL:
  51. if (record->event.pressed) {
  52. // when keycode GITPULL is pressed
  53. SEND_STRING("git pull");
  54. }
  55. break;
  56. case GITPUSH:
  57. if (record->event.pressed) {
  58. // when keycode GITPUSH is pressed
  59. SEND_STRING("git push");
  60. }
  61. break;
  62. case GITCOM:
  63. if (record->event.pressed) {
  64. // when keycode GITCOM is pressed
  65. SEND_STRING("git commit -m ");
  66. }
  67. break;
  68. default:
  69. return true;
  70. }
  71. return true;
  72. }