You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

246 lines
8.7 KiB

  1. /* Copyright 2021 Ibnu D. Aji
  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. #ifdef CONSOLE_ENABLE
  18. #include "print.h"
  19. #endif
  20. // enum for combos.
  21. enum combos {
  22. // left hand combinations.
  23. L_U_PINKY_RING,
  24. L_U_RING_MIDDLE,
  25. L_U_RING_INDEX,
  26. L_U_MIDDLE_INDEX,
  27. L_U_MIDDLE_INNER_INDEX,
  28. L_U_INDEX_INNER_INDEX,
  29. L_L_PINKY_RING,
  30. L_L_RING_MIDDLE,
  31. L_L_RING_INDEX,
  32. L_L_MIDDLE_INDEX,
  33. L_L_INDEX_INNER_INDEX,
  34. L_U_RING_MIDDLE_INDEX,
  35. L_L_RING_MIDDLE_INDEX,
  36. // right hand combinations.
  37. R_U_PINKY_RING,
  38. R_U_RING_MIDDLE,
  39. R_U_RING_INDEX,
  40. R_U_MIDDLE_INDEX,
  41. R_U_MIDDLE_INNER_INDEX,
  42. R_U_INNER_INNER_INDEX,
  43. R_L_PINKY_RING,
  44. R_L_RING_MIDDLE,
  45. R_L_MIDDLE_INDEX,
  46. R_L_RING_INDEX,
  47. R_L_INDEX_INNER_INDEX,
  48. R_U_RING_MIDDLE_INDEX,
  49. R_L_RING_MIDDLE_INDEX,
  50. // both hands combinations.
  51. B_L_MIDDLE_MIDDLE,
  52. };
  53. enum {
  54. _BASE,
  55. _LOWER,
  56. _RAISE,
  57. _ADJUST,
  58. };
  59. enum custom_keycodes {
  60. BASE = SAFE_RANGE,
  61. LOWER,
  62. RAISE,
  63. ADJUST,
  64. };
  65. // keycode abstraction
  66. #define LUP KC_Q
  67. #define LUR KC_V
  68. #define LUM KC_C
  69. #define LUI KC_P
  70. #define LUII KC_B
  71. #define LMP KC_R
  72. #define LMR KC_S
  73. #define LMM KC_T
  74. #define LMI KC_H
  75. #define LMII KC_D
  76. #define LLP KC_QUOT
  77. #define LLR KC_J
  78. #define LLM KC_G
  79. #define LLI KC_K
  80. #define LLII KC_X
  81. #define RUP KC_Z
  82. #define RUR KC_Y
  83. #define RUM KC_U
  84. #define RUI KC_L
  85. #define RUII KC_DOT
  86. #define RMP KC_O
  87. #define RMR KC_I
  88. #define RMM KC_A
  89. #define RMI KC_N
  90. #define RMII KC_F
  91. #define RLP KC_SLSH
  92. #define RLR KC_COMM
  93. #define RLM KC_W
  94. #define RLI KC_M
  95. #define RLII KC_SCLN
  96. // thumb keys.
  97. #define TRAISE TG(_RAISE)
  98. #define AL_ENT ALT_T(KC_ENT)
  99. #define SF_BSPC SFT_T(KC_BSPC)
  100. #define CT_ESC CTL_T(KC_ESC)
  101. // home row mods.
  102. #define CTLR LCTL_T(LMR)
  103. #define CTRR RCTL_T(RMR)
  104. #define CT_LEFT LCTL_T(KC_LEFT)
  105. #define CT_SIX RCTL_T(KC_6)
  106. #define SHLP LSFT_T(LMP)
  107. #define SHRP RSFT_T(RMP)
  108. #define SH_HASH LSFT_T(KC_HASH)
  109. #define SH_ZERO RSFT_T(KC_0)
  110. #define ALLM LALT_T(LMM)
  111. #define ALRM RALT_T(RMM)
  112. #define AL_DOWN LALT_T(KC_DOWN)
  113. #define AL_FIVE RALT_T(KC_5)
  114. #define GULII RGUI_T(LMII)
  115. #define GURII LGUI_T(RMII)
  116. #define GU_DLR RGUI_T(KC_DLR)
  117. #define GU_EQL LGUI_T(KC_EQL)
  118. // layer toggle.
  119. #define LW_E LT(_LOWER, KC_E)
  120. #define RS_SPC LT(_RAISE, KC_SPC)
  121. #define LW_RMI LT(_LOWER, RMI)
  122. #define RS_LMI LT(_RAISE, LMI)
  123. // idk, man. not used, i guess.
  124. #define ADDDD MO(_ADJUST)
  125. // common shortcuts for windows and linux that i use.
  126. #define NXTTAB LCTL(KC_PGDN)
  127. #define PRVTAB LCTL(KC_PGUP)
  128. #define UPTAB LCTL(LSFT(KC_PGUP))
  129. #define DNTAB LCTL(LSFT(KC_PGDN))
  130. #define NXTWIN LALT(KC_TAB)
  131. #define PRVWIN LALT(LSFT(KC_TAB))
  132. #define CALDL LCTL(LALT(KC_DEL))
  133. #define TSKMGR LCTL(LSFT(KC_ESC))
  134. #define EXPLR LGUI(KC_E)
  135. #define LCKGUI LGUI(KC_L)
  136. #define CONPST LSFT(KC_INS)
  137. #define CLSGUI LALT(KC_F4)
  138. // left hand combinations.
  139. const uint16_t PROGMEM lu_p_r_combo[] = {LUP, LUR, COMBO_END};
  140. const uint16_t PROGMEM lu_r_m_combo[] = {LUR, LUM, COMBO_END};
  141. const uint16_t PROGMEM lu_r_i_combo[] = {LUR, LUI, COMBO_END};
  142. const uint16_t PROGMEM lu_m_i_combo[] = {LUM, LUI, COMBO_END};
  143. const uint16_t PROGMEM lu_m_ii_combo[] = {LUM, LUII, COMBO_END};
  144. const uint16_t PROGMEM lu_i_ii_combo[] = {LUI, LUII, COMBO_END};
  145. const uint16_t PROGMEM ll_p_r_combo[] = {LLP, LLR, COMBO_END};
  146. const uint16_t PROGMEM ll_r_m_combo[] = {LLR, LLM, COMBO_END};
  147. const uint16_t PROGMEM ll_r_i_combo[] = {LLR, LLI, COMBO_END};
  148. const uint16_t PROGMEM ll_m_i_combo[] = {LLM, LLI, COMBO_END};
  149. const uint16_t PROGMEM ll_i_ii_combo[] = {LLI, LLII, COMBO_END};
  150. const uint16_t PROGMEM lu_r_m_i_combo[] = {LUR, LUM, LUI, COMBO_END};
  151. const uint16_t PROGMEM ll_r_m_i_combo[] = {LLR, LLM, LLI, COMBO_END};
  152. // right hand combinations.
  153. const uint16_t PROGMEM ru_p_r_combo[] = {RUP, RUR, COMBO_END};
  154. const uint16_t PROGMEM ru_r_m_combo[] = {RUR, RUM, COMBO_END};
  155. const uint16_t PROGMEM ru_r_i_combo[] = {RUR, RUI, COMBO_END};
  156. const uint16_t PROGMEM ru_m_i_combo[] = {RUM, RUI, COMBO_END};
  157. const uint16_t PROGMEM ru_m_ii_combo[] = {RUM, RUII, COMBO_END};
  158. const uint16_t PROGMEM ru_i_ii_combo[] = {RUI, RUII, COMBO_END};
  159. const uint16_t PROGMEM rl_p_r_combo[] = {RLP, RLR, COMBO_END};
  160. const uint16_t PROGMEM rl_r_m_combo[] = {RLR, RLM, COMBO_END};
  161. const uint16_t PROGMEM rl_r_i_combo[] = {RLR, RLI, COMBO_END};
  162. const uint16_t PROGMEM rl_m_i_combo[] = {RLM, RLI, COMBO_END};
  163. const uint16_t PROGMEM rl_i_ii_combo[] = {RLI, RLII, COMBO_END};
  164. const uint16_t PROGMEM ru_r_m_i_combo[] = {RUR, RUM, RUI, COMBO_END};
  165. const uint16_t PROGMEM rl_r_m_i_combo[] = {RLR, RLM, RLI, COMBO_END};
  166. // both hand combinations.
  167. const uint16_t PROGMEM bl_m_m_combo[] = {LLM, RLM, COMBO_END};
  168. combo_t key_combos[] = {
  169. // left hand combinations.
  170. [L_U_PINKY_RING] = COMBO(lu_p_r_combo, KC_TAB),
  171. [L_U_RING_MIDDLE] = COMBO(lu_r_m_combo, KC_QUES),
  172. [L_U_RING_INDEX] = COMBO(lu_r_i_combo, PRVTAB),
  173. [L_U_MIDDLE_INDEX] = COMBO(lu_m_i_combo, KC_UNDS),
  174. [L_U_MIDDLE_INNER_INDEX] = COMBO(lu_m_ii_combo, KC_ENT),
  175. [L_U_INDEX_INNER_INDEX] = COMBO(lu_i_ii_combo, KC_PIPE),
  176. [L_L_PINKY_RING] = COMBO(ll_p_r_combo, KC_ENT),
  177. [L_L_RING_MIDDLE] = COMBO(ll_r_m_combo, LCTL(KC_W)),
  178. [L_L_RING_INDEX] = COMBO(ll_r_i_combo, KC_TAB),
  179. [L_L_MIDDLE_INDEX] = COMBO(ll_m_i_combo, KC_DEL),
  180. [L_L_INDEX_INNER_INDEX] = COMBO(ll_i_ii_combo, KC_TILD),
  181. [L_U_RING_MIDDLE_INDEX] = COMBO(lu_r_m_i_combo, KC_PIPE),
  182. [L_L_RING_MIDDLE_INDEX] = COMBO(ll_r_m_i_combo, KC_TILD),
  183. // right hand combinations.
  184. [R_U_PINKY_RING] = COMBO(ru_p_r_combo, KC_BSPC),
  185. [R_U_RING_MIDDLE] = COMBO(ru_r_m_combo, KC_SLSH),
  186. [R_U_RING_INDEX] = COMBO(ru_r_i_combo, NXTTAB),
  187. [R_U_MIDDLE_INDEX] = COMBO(ru_m_i_combo, KC_MINS),
  188. [R_U_MIDDLE_INNER_INDEX] = COMBO(ru_m_ii_combo, KC_ENT),
  189. [R_U_INNER_INNER_INDEX] = COMBO(ru_i_ii_combo, KC_BSLS),
  190. [R_L_PINKY_RING] = COMBO(rl_p_r_combo, KC_BSLS),
  191. [R_L_RING_MIDDLE] = COMBO(rl_r_m_combo, KC_APP),
  192. [R_L_RING_INDEX] = COMBO(rl_r_i_combo, LSFT(KC_TAB)),
  193. [R_L_MIDDLE_INDEX] = COMBO(rl_m_i_combo, KC_DEL),
  194. [R_L_INDEX_INNER_INDEX] = COMBO(rl_i_ii_combo, KC_GRV),
  195. [R_U_RING_MIDDLE_INDEX] = COMBO(ru_r_m_i_combo, KC_BSLS),
  196. [R_L_RING_MIDDLE_INDEX] = COMBO(rl_r_m_i_combo, KC_GRV),
  197. // both hand combinations.
  198. [B_L_MIDDLE_MIDDLE] = COMBO(bl_m_m_combo, KC_ENT),
  199. };
  200. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  201. [0] = LAYOUT_all(
  202. KC_ESC, LUP, LUR, LUM, LUI, LUII, RUII, RUI, RUM, RUR, RUP, KC_BSPC, KC_BSPC,
  203. KC_LCTL,SHLP, CTLR, ALLM, RS_LMI, GULII, GURII, LW_RMI, ALRM, CTRR, SHRP, KC_ENT,
  204. KC_LSFT,LLP, LLR, LLM, LLI, LLII, RLII, RLI, RLM, RLR, RLP, KC_RSFT,MO(1),
  205. KC_LGUI,KC_LALT, KC_LGUI,LW_E, SF_BSPC, AL_ENT, RS_SPC, KC_LALT, KC_RGUI,KC_RCTL
  206. ),
  207. [1] = LAYOUT_all(
  208. KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, KC_BSPC,
  209. KC_LCTL,KC_EXLM,KC_AT, KC_HASH,KC_DLR, KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN, KC_SCLN,
  210. KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT,MO(2),
  211. KC_LGUI,KC_LALT, KC_LGUI,LW_E, SF_BSPC, AL_ENT, RS_SPC, KC_LALT, KC_RGUI,KC_RCTL
  212. ),
  213. [2] = LAYOUT_all(
  214. KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_F13,
  215. KC_LCTL,KC_EXLM,KC_AT, KC_HASH,KC_DLR, KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN, KC_SCLN,
  216. KC_LSFT,KC_Z, KC_X, KC_C, KC_V, QK_BOOT, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT,MO(1),
  217. KC_LGUI,KC_LALT, KC_LGUI,LW_E, SF_BSPC, AL_ENT, RS_SPC, KC_LALT, KC_RGUI,KC_RCTL
  218. ),
  219. };