keymap.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* Copyright 2015-2017 Jack Humbert
  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 "keymap_swedish.h"
  18. extern keymap_config_t keymap_config;
  19. enum planck_layers {
  20. _COLEMAK,
  21. _LOWER,
  22. _RAISE,
  23. _ADJUST
  24. };
  25. #define LOWER MO(_LOWER)
  26. #define RAISE MO(_RAISE)
  27. /* These definitions can be removed once keymap_swe is properly vetted against MacOS */
  28. #define SE_DLR_MAC_V ALGR(LALT(KC_4))
  29. #define SE_AT_MAC_V ALGR(LALT(KC_2))
  30. /* Esc when pressed, ctrl when used as a modifier */
  31. #define KC_ECTL MT(MOD_LCTL, KC_ESC)
  32. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  33. /* Colemak_se
  34. * ,-----------------------------------------------------------------------------------.
  35. * | Tab | Q | W | F | P | G | J | L | U | Y | Ö | Å |
  36. * |------+------+------+------+------+-------------+------+------+------+------+------|
  37. * | ECTR | A | R | S | T | D | H | N | E | I | O | Ä |
  38. * |------+------+------+------+------+------|------+------+------+------+------+------|
  39. * | SCSHE| Z | X | C | V | B | K | M | , | . | - |SCSHE |
  40. * |------+------+------+------+------+------+------+------+------+------+------+------|
  41. * | esc | CTRL | Alt | CMD |Lower |Space |Bksp |Raise | CMD | RALT | HYPER| MEH |
  42. * `-----------------------------------------------------------------------------------'
  43. */
  44. [_COLEMAK] = LAYOUT_planck_grid
  45. (
  46. KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, SE_OSLH, SE_AA,
  47. KC_ECTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, SE_AE,
  48. KC_SFTENT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, SE_MINS, KC_SFTENT,
  49. KC_ESC, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_BSPC, RAISE, KC_RGUI, KC_RALT, KC_HYPR, KC_MEH
  50. ),
  51. /* Lower
  52. * ,-----------------------------------------------------------------------------------.
  53. * | | PIPE | ' | @ | & | | DOWN | | RIGHT| ` | ´ | ~ |
  54. * |------+------+------+------+------+-------------+------+------+------+------+------|
  55. * | | ! | " | # | ? | % | LEFT | / | \ | = | + | * |
  56. * |------+------+------+------+------+------|------+------+------+------+------+------|
  57. * | | | | [ | ] | | UP | { | } | | | |
  58. * |------+------+------+------+------+------+------+------+------+------+------+------|
  59. * | | | | | | | DEL | | Next | Vol- | Vol+ | Play |
  60. * `-----------------------------------------------------------------------------------'
  61. */
  62. [_LOWER] = LAYOUT_planck_grid
  63. (
  64. _______, SE_PIPE_MAC, SE_APOS, SE_AT_MAC_V, SE_AMPR, _______, KC_DOWN, KC_NO, KC_RGHT, SE_GRV, SE_GRV, SE_TILD,
  65. _______, KC_EXLM, SE_QUO2, KC_HASH, SE_QUES, KC_PERC, KC_LEFT, SE_SLSH, SE_BSLS_MAC, SE_EQL, KC_PPLS, KC_PAST,
  66. _______, KC_NO, KC_NO, SE_LBRC, SE_RBRC, KC_NO, KC_UP, SE_LCBR_MAC, SE_RCBR_MAC, KC_NO, KC_NO, _______,
  67. _______, _______, _______, _______, _______, _______, KC_DEL, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
  68. ),
  69. /* Raise
  70. * ,-----------------------------------------------------------------------------------.
  71. * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
  72. * |------+------+------+------+------+-------------+------+------+------+------+------|
  73. * | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | $ |
  74. * |------+------+------+------+------+------|------+------+------+------+------+------|
  75. * | | | | < | > | | | ( | ) |Pg Up |Pg Dn | |
  76. * |------+------+------+------+------+------+------+------+------+------+------+------|
  77. * | | | | | | | | Next | Vol- | Vol+ | Play |
  78. * `-----------------------------------------------------------------------------------'
  79. */
  80. [_RAISE] = LAYOUT_planck_grid
  81. (
  82. KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
  83. SE_CIRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, SE_DLR_MAC_V,
  84. _______, KC_NO, KC_NO, SE_LESS_MAC, SE_GRTR_MAC, KC_NO, KC_NO, SE_LPRN, SE_RPRN, KC_PGUP, KC_PGDN, KC_NO,
  85. _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
  86. ),
  87. /* Adjust (Lower + Raise)
  88. * ,-----------------------------------------------------------------------------------.
  89. * | | Reset| Debug| | | | | | | | | |
  90. * |------+------+------+------+------+-------------+------+------+------+------+------|
  91. * | | | | | | | | | | | | |
  92. * |------+------+------+------+------+------|------+------+------+------+------+------|
  93. * | | | | | | | | | | | | |
  94. * |------+------+------+------+------+------+------+------+------+------+------+------|
  95. * | | | | | | | | | | | |
  96. * `-----------------------------------------------------------------------------------'
  97. */
  98. [_ADJUST] = LAYOUT_planck_grid
  99. (
  100. _______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  101. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  102. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  103. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  104. )
  105. };
  106. uint32_t layer_state_set_user(uint32_t state) {
  107. return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
  108. }