keymap.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. /* Copyright 2019 Thomas Baart <thomas@splitkb.com>
  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. uint16_t copy_paste_timer;
  18. enum layers {
  19. QWERTY = 0,
  20. LOWER,
  21. RAISE,
  22. NAV,
  23. ADJUST
  24. };
  25. enum custom_keycodes {
  26. KC_CCCV = SAFE_RANGE
  27. };
  28. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  29. /*
  30. * Base Layer: QWERTY
  31. *
  32. * ,-------------------------------------------. ,-------------------------------------------.
  33. * | ESC | Q | W | E | R | T | | Y | U | I | O | P | | \ |
  34. * |--------+------+------+------+------+------| |------+------+------+------+------+--------|
  35. * | LSFT | A | S | D | F | G | | H | J | K | L | ; : | ' " |
  36. * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
  37. * | LCTL | Z | X | C | V | B | CCCV | | | Del |Leader| N | M | , < | . > | / ? | - _ |
  38. * `----------------------+------+------+------+------+ | |------+------+------+------+------+----------------------'
  39. * | GUI | Alt | | Space| Enter| | Bspc | Space| | Tab | AltGr|
  40. * | | | Lower| Shift| Alt | | | Nav | Raise| | |
  41. * `----------------------------------' `----------------------------------'
  42. */
  43. [QWERTY] = LAYOUT(
  44. KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_PIPE,
  45. KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
  46. KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_CCCV, XXXXXXX, KC_DEL, KC_LEAD, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_MINS,
  47. KC_LGUI, KC_LALT, MO(LOWER), MT(MOD_LSFT, KC_SPC), MT(MOD_LALT, KC_ENT), KC_BSPC, LT(NAV, KC_SPC), MO(RAISE), KC_TAB, KC_RALT
  48. ),
  49. /*
  50. * Lower Layer: Numpad, Media
  51. *
  52. * ,-------------------------------------------. ,-------------------------------------------.
  53. * | | | | VolUp| | | | / ? | 7 & | 8 * | 9 ( | - _ | |
  54. * |--------+------+------+------+------+------| |------+------+------+------+------+--------|
  55. * | | | Prev | Play | Next | | | * | 4 $ | 5 % | 6 ^ | , < | + |
  56. * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
  57. * | | | | VolDn| Mute | | | | | | | 0 ) | 1 ! | 2 @ | 3 # | = + | |
  58. * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
  59. * | | | | | | | | | | | |
  60. * | | | Lower| | | | | Nav | Raise| | |
  61. * `----------------------------------' `----------------------------------'
  62. */
  63. [LOWER] = LAYOUT(
  64. _______, _______, _______, KC_VOLU, _______, _______, KC_SLSH, KC_7, KC_8, KC_9, KC_MINS, _______,
  65. _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, KC_ASTR, KC_4, KC_5, KC_6, KC_COMM, KC_PLUS,
  66. _______, _______, _______, KC_VOLD, KC_MUTE, _______, _______, _______, _______, _______, KC_0, KC_1, KC_2, KC_3, KC_EQL, _______,
  67. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  68. ),
  69. /*
  70. * Raise Layer: Symbols
  71. *
  72. * ,-------------------------------------------. ,-------------------------------------------.
  73. * | | ! | @ | { | } | | | | | _ | € | | | \ |
  74. * |--------+------+------+------+------+------| |------+------+------+------+------+--------|
  75. * | | # | $ | ( | ) | ` | | + | - | / | * | % | ' " |
  76. * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
  77. * | | % | ^ | [ | ] | ~ | | | | | | & | = | , | . | / ? | - _ |
  78. * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
  79. * | | | | | | | | | | | |
  80. * | | | Lower| | | | | Nav | Raise| | |
  81. * `----------------------------------' `----------------------------------'
  82. */
  83. [RAISE] = LAYOUT(
  84. _______, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, _______, KC_UNDS, ALGR(KC_5),_______,_______,KC_BSLS,
  85. _______, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV, KC_PLUS, KC_MINS, KC_SLSH, KC_ASTR, KC_PERC, KC_QUOT,
  86. _______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, _______, _______, _______, _______, KC_AMPR, KC_EQL, KC_COMM, KC_DOT, KC_SLSH, KC_MINS,
  87. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  88. ),
  89. /*
  90. * Navigation Layer
  91. *
  92. * ,-------------------------------------------. ,-------------------------------------------.
  93. * | | | | | | | | PgUp | Home | Up | End | | ScrlLk |
  94. * |--------+------+------+------+------+------| |------+------+------+------+------+--------|
  95. * | | | | | | | | PgDn | Left | Down | Right| | CapsLk |
  96. * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
  97. * | | | | | | | | | | | | | | | | | |
  98. * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
  99. * | | | | | | | | | | | |
  100. * | | | Lower| | | | | Nav | Raise| | |
  101. * `----------------------------------' `----------------------------------'
  102. */
  103. [NAV] = LAYOUT(
  104. _______, _______, _______, _______, _______, _______, KC_PGUP, KC_HOME, KC_UP, KC_END, _______, KC_SCRL,
  105. _______, _______, _______, _______, _______, _______, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, _______, KC_CAPS,
  106. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  107. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  108. ),
  109. /*
  110. * Adjust Layer
  111. *
  112. * ,-------------------------------------------. ,-------------------------------------------.
  113. * | | | | | | | | | F7 | F8 | F9 | F10 | |
  114. * |--------+------+------+------+------+------| |------+------+------+------+------+--------|
  115. * | | | SAI | HUI | VAI | | | | F4 | F5 | F6 | F11 | |
  116. * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
  117. * | | | SAD | HUD | VAD | | | | | | | | F1 | F2 | F3 | F12 | |
  118. * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
  119. * | | | | | | | | | | | |
  120. * | | | | | | | | | | | |
  121. * `----------------------------------' `----------------------------------'
  122. */
  123. [ADJUST] = LAYOUT(
  124. _______, _______, _______, _______, _______, _______, _______, KC_F7, KC_F8, KC_F9, KC_F10, _______,
  125. _______, _______, RGB_SAI, RGB_HUI, RGB_VAI, _______, _______, KC_F4, KC_F5, KC_F6, KC_F11, _______,
  126. _______, _______, RGB_SAD, RGB_HUD, RGB_VAD, _______, _______, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F12, _______,
  127. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  128. ),
  129. // /*
  130. // * Layer template
  131. // *
  132. // * ,-------------------------------------------. ,-------------------------------------------.
  133. // * | | | | | | | | | | | | | |
  134. // * |--------+------+------+------+------+------| |------+------+------+------+------+--------|
  135. // * | | | | | | | | | | | | | |
  136. // * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
  137. // * | | | | | | | | | | | | | | | | | |
  138. // * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
  139. // * | | | | | | | | | | | |
  140. // * | | | | | | | | | | | |
  141. // * `----------------------------------' `----------------------------------'
  142. // */
  143. // [_LAYERINDEX] = LAYOUT(
  144. // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  145. // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  146. // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  147. // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  148. // ),
  149. };
  150. layer_state_t layer_state_set_user(layer_state_t state) {
  151. return update_tri_layer_state(state, LOWER, RAISE, ADJUST);
  152. }
  153. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  154. switch (keycode) {
  155. case KC_CCCV: // One key copy/paste
  156. if (record->event.pressed) {
  157. copy_paste_timer = timer_read();
  158. } else {
  159. if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
  160. tap_code16(LCTL(KC_C));
  161. } else { // Tap, paste
  162. tap_code16(LCTL(KC_V));
  163. }
  164. }
  165. break;
  166. }
  167. return true;
  168. }
  169. bool is_alt_tab_active = false;
  170. uint16_t alt_tab_timer = 0;
  171. LEADER_EXTERNS();
  172. void matrix_scan_user(void) {
  173. if (is_alt_tab_active) {
  174. if (timer_elapsed(alt_tab_timer) > 1000) {
  175. unregister_code(KC_LALT);
  176. is_alt_tab_active = false;
  177. }
  178. }
  179. LEADER_DICTIONARY() {
  180. leading = false;
  181. leader_end();
  182. SEQ_ONE_KEY(KC_C) { // Inline Code
  183. SEND_STRING("`` " SS_TAP(X_LEFT) SS_TAP(X_LEFT));
  184. }
  185. SEQ_ONE_KEY(KC_P) { // Invoke Password Manager
  186. SEND_STRING(SS_LCTL(SS_LALT("\\")));
  187. }
  188. SEQ_ONE_KEY(KC_S) { // Windows screenshot
  189. SEND_STRING(SS_LGUI("\nS"));
  190. }
  191. SEQ_TWO_KEYS(KC_F, KC_P) { // Fusion Projection prefix
  192. SEND_STRING("[Projection] ");
  193. }
  194. SEQ_TWO_KEYS(KC_B, KC_B) { // Basecone invoice description
  195. SEND_STRING("[Leveranciersnaam] [Factuurnummer]");
  196. }
  197. SEQ_TWO_KEYS(KC_E, KC_S) { // Support email splitkb
  198. SEND_STRING("support@splitkb.com");
  199. }
  200. SEQ_TWO_KEYS(KC_E, KC_T) { // Email splitkb
  201. SEND_STRING("thomas@splitkb.com");
  202. }
  203. SEQ_TWO_KEYS(KC_E, KC_P) { // Email personal
  204. SEND_STRING("mail@thomasbaart.nl");
  205. }
  206. SEQ_TWO_KEYS(KC_S, KC_D) { // Splitkb documentation
  207. SEND_STRING("https://docs.splitkb.com/");
  208. }
  209. SEQ_TWO_KEYS(KC_S, KC_V) { // Splitkb VAT number
  210. SEND_STRING("NL210593349B01");
  211. }
  212. SEQ_TWO_KEYS(KC_B, KC_C) { // Discord bongocat
  213. SEND_STRING(":bongocat:\n");
  214. }
  215. SEQ_TWO_KEYS(KC_C, KC_B) { // Discord code block
  216. SEND_STRING("```c" SS_LSFT("\n\n") "``` " SS_TAP(X_UP));
  217. }
  218. SEQ_TWO_KEYS(KC_Y, KC_S) { // Greeting
  219. SEND_STRING("Yours sincerely,\n\nThomas Baart");
  220. }
  221. SEQ_THREE_KEYS(KC_M, KC_V, KC_G) { // Greeting
  222. SEND_STRING("Met vriendelijke groet,\n\nThomas Baart");
  223. }
  224. }
  225. }
  226. #ifdef OLED_ENABLE
  227. oled_rotation_t oled_init_user(oled_rotation_t rotation) {
  228. return OLED_ROTATION_180;
  229. }
  230. static void render_kyria_logo(void) {
  231. static const char PROGMEM kyria_logo[] = {
  232. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,192,224,240,112,120, 56, 60, 28, 30, 14, 14, 14, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 30, 28, 60, 56,120,112,240,224,192,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  233. 0, 0, 0, 0, 0, 0, 0,192,224,240,124, 62, 31, 15, 7, 3, 1,128,192,224,240,120, 56, 60, 28, 30, 14, 14, 7, 7,135,231,127, 31,255,255, 31,127,231,135, 7, 7, 14, 14, 30, 28, 60, 56,120,240,224,192,128, 1, 3, 7, 15, 31, 62,124,240,224,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  234. 0, 0, 0, 0,240,252,255, 31, 7, 1, 0, 0,192,240,252,254,255,247,243,177,176, 48, 48, 48, 48, 48, 48, 48,120,254,135, 1, 0, 0,255,255, 0, 0, 1,135,254,120, 48, 48, 48, 48, 48, 48, 48,176,177,243,247,255,254,252,240,192, 0, 0, 1, 7, 31,255,252,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  235. 0, 0, 0,255,255,255, 0, 0, 0, 0, 0,254,255,255, 1, 1, 7, 30,120,225,129,131,131,134,134,140,140,152,152,177,183,254,248,224,255,255,224,248,254,183,177,152,152,140,140,134,134,131,131,129,225,120, 30, 7, 1, 1,255,255,254, 0, 0, 0, 0, 0,255,255,255, 0, 0, 0, 0,255,255, 0, 0,192,192, 48, 48, 0, 0,240,240, 0, 0, 0, 0, 0, 0,240,240, 0, 0,240,240,192,192, 48, 48, 48, 48,192,192, 0, 0, 48, 48,243,243, 0, 0, 0, 0, 0, 0, 48, 48, 48, 48, 48, 48,192,192, 0, 0, 0, 0, 0,
  236. 0, 0, 0,255,255,255, 0, 0, 0, 0, 0,127,255,255,128,128,224,120, 30,135,129,193,193, 97, 97, 49, 49, 25, 25,141,237,127, 31, 7,255,255, 7, 31,127,237,141, 25, 25, 49, 49, 97, 97,193,193,129,135, 30,120,224,128,128,255,255,127, 0, 0, 0, 0, 0,255,255,255, 0, 0, 0, 0, 63, 63, 3, 3, 12, 12, 48, 48, 0, 0, 0, 0, 51, 51, 51, 51, 51, 51, 15, 15, 0, 0, 63, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 63, 63, 48, 48, 0, 0, 12, 12, 51, 51, 51, 51, 51, 51, 63, 63, 0, 0, 0, 0, 0,
  237. 0, 0, 0, 0, 15, 63,255,248,224,128, 0, 0, 3, 15, 63,127,255,239,207,141, 13, 12, 12, 12, 12, 12, 12, 12, 30,127,225,128, 0, 0,255,255, 0, 0,128,225,127, 30, 12, 12, 12, 12, 12, 12, 12, 13,141,207,239,255,127, 63, 15, 3, 0, 0,128,224,248,255, 63, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  238. 0, 0, 0, 0, 0, 0, 0, 3, 7, 15, 62,124,248,240,224,192,128, 1, 3, 7, 15, 30, 28, 60, 56,120,112,112,224,224,225,231,254,248,255,255,248,254,231,225,224,224,112,112,120, 56, 60, 28, 30, 15, 7, 3, 1,128,192,224,240,248,124, 62, 15, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  239. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 7, 15, 14, 30, 28, 60, 56,120,112,112,112,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,112,112,112,120, 56, 60, 28, 30, 14, 15, 7, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  240. };
  241. oled_write_raw_P(kyria_logo, sizeof(kyria_logo));
  242. }
  243. static void render_qmk_logo(void) {
  244. static const char PROGMEM qmk_logo[] = {
  245. 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
  246. 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
  247. 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
  248. oled_write_P(qmk_logo, false);
  249. }
  250. static void render_status(void) {
  251. // QMK Logo and version information
  252. render_qmk_logo();
  253. oled_write_P(PSTR(" Kyria rev1.0\n\n"), false);
  254. // Host Keyboard Layer Status
  255. oled_write_P(PSTR("Layer: "), false);
  256. switch (get_highest_layer(layer_state)) {
  257. case QWERTY:
  258. oled_write_P(PSTR("Default\n"), false);
  259. break;
  260. case LOWER:
  261. oled_write_P(PSTR("Lower\n"), false);
  262. break;
  263. case RAISE:
  264. oled_write_P(PSTR("Raise\n"), false);
  265. break;
  266. case NAV:
  267. oled_write_P(PSTR("Navigation\n"), false);
  268. break;
  269. case ADJUST:
  270. oled_write_P(PSTR("Adjust\n"), false);
  271. break;
  272. default:
  273. oled_write_P(PSTR("Undefined\n"), false);
  274. }
  275. // Host Keyboard LED Status
  276. uint8_t led_usb_state = host_keyboard_leds();
  277. oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
  278. oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
  279. oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
  280. }
  281. bool oled_task_user(void) {
  282. if (is_keyboard_master()) {
  283. render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
  284. } else {
  285. render_kyria_logo();
  286. }
  287. return false;
  288. }
  289. #endif
  290. #ifdef ENCODER_ENABLE
  291. bool encoder_update_user(uint8_t index, bool clockwise) {
  292. if (index == 0) {
  293. switch (get_highest_layer(layer_state)) {
  294. case QWERTY:
  295. // History scrubbing. For Adobe products, hold shift while moving
  296. // backward to go forward instead.
  297. if (clockwise) {
  298. tap_code16(C(KC_Z));
  299. } else {
  300. tap_code16(C(KC_Y));
  301. }
  302. break;
  303. default:
  304. // Switch between windows on Windows with alt tab.
  305. if (clockwise) {
  306. if (!is_alt_tab_active) {
  307. is_alt_tab_active = true;
  308. register_code(KC_LALT);
  309. }
  310. alt_tab_timer = timer_read();
  311. tap_code16(KC_TAB);
  312. } else {
  313. tap_code16(S(KC_TAB));
  314. }
  315. break;
  316. }
  317. } else if (index == 1) {
  318. switch (get_highest_layer(layer_state)) {
  319. case QWERTY:
  320. // Scrolling with PageUp and PgDn.
  321. if (clockwise) {
  322. tap_code(KC_PGDN);
  323. } else {
  324. tap_code(KC_PGUP);
  325. }
  326. break;
  327. default:
  328. // Volume control.
  329. if (clockwise) {
  330. tap_code(KC_VOLU);
  331. } else {
  332. tap_code(KC_VOLD);
  333. }
  334. break;
  335. }
  336. }
  337. return true;
  338. }
  339. #endif