Skip to content

Instantly share code, notes, and snippets.

@rootiest
Created June 20, 2021 17:13
Show Gist options
  • Save rootiest/9a36e81c6aa86bf6445424ce6a88834e to your computer and use it in GitHub Desktop.
Save rootiest/9a36e81c6aa86bf6445424ce6a88834e to your computer and use it in GitHub Desktop.
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */
switch (biton32(layer_state)) {
case 0:
if ((get_mods() & MOD_MASK_SHIFT)) { // Shifted
const uint8_t _real_mods = get_mods();
unregister_code16(KC_LSFT);
unregister_code16(KC_RSFT);
if (clockwise) {
tap_code16(KC_WH_D);
} else {
tap_code16(KC_WH_U);
}
set_mods(_real_mods);
return false;
break;
}
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment