keymap.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #include "planck.h"
  2. #ifdef BACKLIGHT_ENABLE
  3. #include "backlight.h"
  4. #endif
  5. /* Each layer is given a name to aid in readability, which is then
  6. used in the keymap matrix below. The underscores do not denote
  7. anything - you can have a layer called STUFF or any other name.
  8. Layer names don't all need to be of the same length, obviously, and
  9. you could also skip them entirely and just use numbers, though that
  10. means needing to manage the numbers.
  11. It is preferable to keep the symbols short so that a line worth of
  12. key mappings fits compactly onto a line of code. */
  13. /* This was originally based on planck/keymaps/default/default.c, and
  14. then cbbrowne has revised things */
  15. /* Things I did not like about the default mapping
  16. - I find control too hard to get to. I think I'll want it on a
  17. left finger. Gonna need to lose something to do that...
  18. - Almost certainly, KC_LCTL should be on [2][1]
  19. - having dash on [lower-j] is a bit nonintuitive, but may be OK
  20. - I'll bet I should switch ESC/TAB
  21. - I'm suspicious that I want to shift M(0) from [4][1] to [4][2],
  22. and shift ESC off the first column so KC_LCTL and KC_LALT can
  23. be on the first column.
  24. - I think I wanna swap ' and ENTER
  25. - I'm keeping Colemak and Dvorak around for reference, and added
  26. Workman just for fun. They're useless to me, though.
  27. */
  28. /* Other things to do...
  29. - Need to think about what zsh and readline actions I use lots
  30. - Wanna figure out macros, so I can put in a "cbbrowne" macro
  31. - Ought to ensure that Control-Alt-Delete is convenient enough
  32. - How about Alt-F1 thru Alt-F8?
  33. - What's the keystroke to get from X to console these days?
  34. - I do indeed want a sweet number pad!
  35. - A layer for doing console switching would not be a bad idea
  36. */
  37. enum layers {
  38. _QW = 0, /* Qwerty mapping */
  39. _CM, /* Colemak */
  40. _DV, /* Dvorak */
  41. _WK, /* Workman */
  42. _LW, /* Lower layer, where top line has symbols !@#$%^&*() */
  43. _RS, /* Raised layer, where top line has digits 1234567890 */
  44. _KP, /* Key pad */
  45. };
  46. /* Note that Planck has dimensions 4 rows x 12 columns */
  47. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  48. [_QW] = { /* Qwerty */
  49. {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
  50. {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
  51. {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
  52. {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
  53. },
  54. [_CM] = { /* Colemak */
  55. {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
  56. {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
  57. {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
  58. {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
  59. },
  60. [_DV] = { /* Dvorak */
  61. {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
  62. {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
  63. {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
  64. {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
  65. },
  66. [_WK] = { /* Workman */
  67. {KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSPC},
  68. {KC_ESC, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT},
  69. {KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
  70. {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
  71. },
  72. [_RS] = { /* RAISE */
  73. {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
  74. {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
  75. {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_WK), RESET, KC_TRNS},
  76. {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
  77. },
  78. [_LW] = { /* LOWER */
  79. {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
  80. {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
  81. {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_WK), RESET, KC_TRNS},
  82. {KC_TRNS, DF(_KP), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
  83. },
  84. [_KP] = { /* Key Pad */
  85. {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_ENTER, KC_KP_PLUS, KC_KP_PLUS, KC_KP_ENTER, KC_KP_ENTER},
  86. {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_MINUS, KC_7, KC_8, KC_9, KC_KP_DOT},
  87. {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_PLUS, KC_4, KC_5, KC_6, KC_0},
  88. {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, DF(_QW), KC_1, KC_2, KC_3, KC_0}
  89. }
  90. };
  91. /* I'm planning to use this to set up some macros, including one to
  92. expand into "cbbrowne", more to prove it can be done than anything
  93. else.
  94. */
  95. enum macro_id {
  96. M_P0,
  97. M_P1,
  98. M_P2,
  99. M_P3,
  100. M_P4,
  101. M_P5,
  102. M_USERNAME
  103. };
  104. const uint16_t PROGMEM fn_actions[] = {
  105. };
  106. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
  107. {
  108. // MACRODOWN only works in this function
  109. switch(id) {
  110. case 0:
  111. if (record->event.pressed) {
  112. register_code(KC_RSFT);
  113. #ifdef BACKLIGHT_ENABLE
  114. backlight_step();
  115. #endif
  116. } else {
  117. unregister_code(KC_RSFT);
  118. }
  119. break;
  120. }
  121. return MACRO_NONE;
  122. };