keymap.c 10 KB

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