Skip to content

Commit

Permalink
Right encoder left/right word on nav layer
Browse files Browse the repository at this point in the history
  • Loading branch information
halcyonCorsair committed Jan 31, 2022
1 parent 6d68657 commit 1843ee2
Showing 1 changed file with 2 additions and 38 deletions.
40 changes: 2 additions & 38 deletions users/halcyoncorsair/encoder_config.c
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
#include "encoder_config.h"

#ifdef ENCODER_ENABLE
bool is_alt_tab_active = false;
uint16_t alt_tab_timer = 0;

void matrix_scan_user(void) {
if (is_alt_tab_active) {
if (timer_elapsed(alt_tab_timer) > 700) {
#ifdef MAC_HOTKEYS
register_code(KC_LGUI);
#else
register_code(KC_LALT);
#endif
unregister_code(KC_LGUI);
is_alt_tab_active = false;
}
}
}

bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { // Left - Industrial encoder
if (layer_state_is(_SYM)) {
Expand All @@ -38,28 +21,9 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
} else if (index == 1) { // Right - Linear encoder
if (layer_state_is(_NAV)) {
if (clockwise) {
if (!is_alt_tab_active) {
is_alt_tab_active = true;
#ifdef MAC_HOTKEYS
register_code(KC_LGUI);
#else
register_code(KC_LALT);
#endif
}
alt_tab_timer = timer_read();
tap_code16(KC_TAB);
tap_code16(LALT(KC_LEFT));
} else {
if (!is_alt_tab_active) {
is_alt_tab_active = true;
register_code(KC_LGUI);
#ifdef MAC_HOTKEYS
register_code(KC_LGUI);
#else
register_code(KC_LALT);
#endif
}
alt_tab_timer = timer_read();
tap_code16(S(KC_TAB));
tap_code16(LALT(KC_RIGHT));
}
} else {
// Volume control
Expand Down

0 comments on commit 1843ee2

Please sign in to comment.