keymap.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /* Copyright 2020 Reid Sox-Harris
  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. #include "muse.h"
  18. enum planck_layers {
  19. _QWERTY,
  20. _GAME,
  21. _UPPER,
  22. _LOWER,
  23. _UTILS
  24. };
  25. enum planck_keycodes {
  26. TMUX_WN = SAFE_RANGE,
  27. TMUX_WL
  28. };
  29. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  30. switch (keycode) {
  31. case TMUX_WN: // Moves to the next tmux window
  32. if (record->event.pressed) {
  33. SEND_STRING(SS_LCTL("a") "n");
  34. }
  35. break;
  36. case TMUX_WL: // Moves to the last tmux window
  37. if (record->event.pressed) {
  38. SEND_STRING(SS_LCTL("a") "n");
  39. }
  40. break;
  41. }
  42. return true;
  43. };
  44. #define UPPER MO(_UPPER)
  45. #define LOWER MO(_LOWER)
  46. #define UTILS MO(_UTILS)
  47. #define GAME TG(_GAME)
  48. #define WM_R LCTL(KC_RGHT) // Moves the MacOS WM window to the right
  49. #define WM_L LCTL(KC_LEFT) // ...and to the left
  50. #define WM_MC LCTL(KC_UP) // Opens MacOS Mission Control
  51. #define WEB_R LGUI(KC_RCBR) // Move one tab to the right, works on Firefox, Chrome
  52. #define WEB_L LGUI(KC_LCBR) // ...and to the left
  53. #define TMUX_U RALT(KC_UP) // Changes focus in tmux, requires a keybinding in tmux.conf
  54. #define TMUX_D RALT(KC_DOWN)
  55. #define TMUX_R RALT(KC_RGHT)
  56. #define TMUX_L RALT(KC_LEFT)
  57. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  58. [_QWERTY] = LAYOUT_planck_grid(
  59. // ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐
  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. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  62. KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
  63. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  64. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_BSPC,
  65. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  66. KC_NO, KC_NO, KC_LCTL, KC_LGUI, UPPER, KC_ENT, KC_SPC, LOWER, KC_RALT, KC_VOLU, KC_VOLD, KC_MUTE
  67. // └────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘
  68. ),
  69. [_GAME] = LAYOUT_planck_grid(
  70. // ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐
  71. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  72. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  73. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  74. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  75. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  76. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  77. _______, _______, _______, _______, _______, KC_SPC, KC_ENT, _______, _______, _______, _______, _______
  78. // └────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘
  79. ),
  80. [_UPPER] = LAYOUT_planck_grid(
  81. // ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐
  82. KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL,
  83. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  84. _______, WEB_L, WEB_R, WM_MC, WM_L, WM_R, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_PGUP, KC_BSLS,
  85. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  86. _______, KC_NO, KC_LABK, KC_LBRC, KC_LPRN, KC_LCBR, KC_RCBR, KC_RPRN, KC_RBRC, KC_RABK, KC_PGDN, _______,
  87. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  88. _______, _______, _______, _______, UPPER, _______, _______, UTILS, _______, KC_MPRV, KC_MPLY, KC_MNXT
  89. // └────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘
  90. ),
  91. [_LOWER] = LAYOUT_planck_grid(
  92. // ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐
  93. KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PLUS,
  94. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  95. _______, TMUX_WL, TMUX_WN, KC_NO, KC_NO, KC_NO, TMUX_L, TMUX_D, TMUX_U, TMUX_R, KC_NO, KC_PIPE,
  96. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  97. _______, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, KC_NO, KC_DEL,
  98. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  99. _______, _______, _______, _______, UTILS, _______, _______, LOWER, _______, _______, _______, _______
  100. // └────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘
  101. ),
  102. [_UTILS] = LAYOUT_planck_grid(
  103. // ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐
  104. KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
  105. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  106. RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, KC_NO, KC_INS, KC_HOME, AU_ON, KC_NO, GAME,
  107. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  108. KC_NO, RGB_RMOD,RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD, KC_SLEP, KC_DEL, KC_END, AU_OFF, KC_NO, QK_BOOT,
  109. // ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
  110. _______, _______, _______, _______, UTILS, _______, _______, UTILS, _______, _______, _______, _______
  111. // └────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘
  112. )
  113. };