keymap.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /* Keymap for Space Oddity Keyboard
  2. Copyright (C) 2017 James Taylor
  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 3 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 <https://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. // Custom keycodes needed for dynamic macros.
  16. enum custom_keycodes {
  17. QWERTY = SAFE_RANGE,
  18. PAIR_PR,
  19. PAIR_BR,
  20. PAIR_CB,
  21. LAMBDA
  22. };
  23. // Tap Dance initializer.
  24. enum {
  25. SFT_CAPS = 0,
  26. };
  27. // Tap dance actions - double tap for Caps Lock.
  28. qk_tap_dance_action_t tap_dance_actions[] = {
  29. [SFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS),
  30. };
  31. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  32. /* Here is an ASCII version of the base layout. Note that Dynamic Macros 1 and 2 are considered Macro 5 and Macro 6.
  33. *
  34. * ___________________________________________________________________________________
  35. * | | | | | | Dynamic | Dynamic |
  36. * | () | [] | {} | NO OP | NO OP | Macro 1 | Macro 2 |
  37. * |___________|___________|___________|___________|___________|___________|___________|
  38. * | | | | | | | | | | | | |
  39. * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BKSP |
  40. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  41. * | | | | | | | | | | | | |
  42. * | TAB | Q | W | E | R | T | Y | U | I | O | P | - |
  43. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  44. * | | | | | | | | | | | | |
  45. * |ESC (CTL_T)| A | S | D | F | G | H | J | K | L | ; | ' |
  46. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  47. * | | | | | | | | | | | | |
  48. * | SHFT | Z | X | C | V | B | N | M | , | . | / |SHFT(ENT)|
  49. * |_________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_________|
  50. * | | | | | | | ALT | HYP | LT 1| LT 2|
  51. * |MO(2)|MO(1)| GUI | ALT | CTRL | SPC |(LFT)|(RGT)| (UP)|(DWN)|
  52. * |_____|_____|_____|_____|___________|___________|_____|_____|_____|_____|
  53. */
  54. [0] = LAYOUT( \
  55. PAIR_PR, PAIR_BR, PAIR_CB, XXXXXXX, XXXXXXX, DM_PLY1, DM_PLY2, \
  56. KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
  57. KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS, \
  58. CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
  59. TD(SFT_CAPS), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT), \
  60. MO(2), MO(1), KC_LGUI, KC_RALT, KC_LCTL, KC_SPC, ALT_T(KC_LEFT), ALL_T(KC_RGHT), LT(1, KC_UP), LT(2, KC_DOWN) \
  61. ),
  62. /* Function layer.
  63. * Blank keys correspond to the KC_TRNS keycode.
  64. *
  65. * ___________________________________________________________________________________
  66. * | | | | | | DYN REC | DYN REC |
  67. * | LAMBDA | | | | | 1 | 2 |
  68. * |___________|___________|___________|___________|___________|___________|___________|
  69. * | DYN REC | | | | | | | | | | | |
  70. * | STOP | F1 | F2 | F3 | F4 | F5 | [ | 7 | 8 | 9 | * | DEL |
  71. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  72. * | | | | | | | | | | | | |
  73. * | | F6 | F7 | F8 | F9 | F10 | ] | 4 | 5 | 6 | + | = |
  74. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  75. * | | | | | | | | | | | | |
  76. * | \ | F11 | F12 | F13 | F14 | F15 | { | 1 | 2 | 3 | - | | |
  77. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  78. * | | | | | | | | | | | | |
  79. * | | F16 | F17 | F18 | F19 | F20 | } | 0 | , | . | / | |
  80. * |_________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_________|
  81. * | | | | | | | | | | |
  82. * | | | | | | | | | | |
  83. * |_____|_____|_____|_____|___________|___________|_____|_____|_____|_____|
  84. *
  85. */
  86. [1] = LAYOUT( \
  87. LAMBDA, _______, _______, _______, _______, DM_REC1, DM_REC2, \
  88. DM_RSTP, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LBRC, KC_P7, KC_P8, KC_P9, KC_ASTR, KC_DEL, \
  89. _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_RBRC, KC_P4, KC_P5, KC_P6, KC_PLUS, KC_EQL, \
  90. KC_BSLS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_LCBR, KC_P1, KC_P2, KC_P3, KC_MINS, KC_PIPE, \
  91. _______, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_RCBR, KC_P0, KC_COMM, KC_DOT, KC_SLSH, _______, \
  92. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  93. ),
  94. /* Mouse layer.
  95. *
  96. * ___________________________________________________________________________________
  97. * | | | | | | | |
  98. * | | | | | | | |
  99. * |___________|___________|___________|___________|___________|___________|___________|
  100. * | | | | MS | | | | | | | | |
  101. * | | | | UP | | | | | | | | |
  102. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  103. * | | | MS | MS | MS | | | | | | | |
  104. * | | | LFT | DWN | RGT | | | MS1 | MS3 | MS2 | | |
  105. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  106. * | | | | | | | | | | | | |
  107. * | | | | | | | | | | | | |
  108. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  109. * | | | | | | | | | | | | |
  110. * | |RESET| | | | | | | | | | |
  111. * |_________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_________|
  112. * | | | | | | | | | | |
  113. * | | | | | | | | | | F(2)|
  114. * |_____|_____|_____|_____|___________|___________|_____|_____|_____|_____|
  115. *
  116. */
  117. [2] = LAYOUT( \
  118. _______, _______, _______, _______, _______, _______, _______, \
  119. _______, _______, _______, KC_MS_U, _______, _______, _______, _______, _______, _______, _______, _______, \
  120. _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, KC_BTN1, KC_BTN3, KC_BTN2, _______, _______, \
  121. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  122. _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  123. _______, _______, _______, _______, _______, _______, _______, _______, _______, TG(2) \
  124. )
  125. };
  126. void matrix_init_user(void) {
  127. }
  128. void matrix_scan_user(void) {
  129. }
  130. // Simple macro ideas follow. Each of them is designed to give you a quick way to create pairs of
  131. // delimiters and then position the cursor between them, much like Emacs' ParEdit does. This way,
  132. // you can have some convenient coding "helpers" even when not using Emacs. It is also nice for
  133. // LaTeX editing.
  134. //
  135. // Customize to your heart's content!
  136. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  137. switch (keycode) {
  138. case PAIR_PR:
  139. if (record->event.pressed) {
  140. SEND_STRING("()"SS_TAP(X_LEFT));
  141. }
  142. return false;
  143. case PAIR_BR:
  144. if (record->event.pressed) {
  145. SEND_STRING("[]"SS_TAP(X_LEFT));
  146. }
  147. return false;
  148. case PAIR_CB:
  149. if (record->event.pressed) {
  150. SEND_STRING("{}"SS_TAP(X_LEFT));
  151. }
  152. return false;
  153. // Probably something only Lisp users will appreciate...
  154. case LAMBDA:
  155. if (record->event.pressed) {
  156. SEND_STRING("(lambda ())"SS_TAP(X_LEFT)SS_TAP(X_LEFT));
  157. }
  158. return false;
  159. }
  160. return true;
  161. }
  162. void led_set_user(uint8_t usb_led) {
  163. if (usb_led & (1 << USB_LED_NUM_LOCK)) {
  164. } else {
  165. }
  166. if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
  167. } else {
  168. }
  169. if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
  170. } else {
  171. }
  172. if (usb_led & (1 << USB_LED_COMPOSE)) {
  173. } else {
  174. }
  175. if (usb_led & (1 << USB_LED_KANA)) {
  176. } else {
  177. }
  178. }