diff options
| author | QMK Bot <hello@qmk.fm> | 2021-10-30 18:54:36 +0000 |
|---|---|---|
| committer | QMK Bot <hello@qmk.fm> | 2021-10-30 18:54:36 +0000 |
| commit | 9e4dd8bfcba41ccac0d28ee8ea218142e7aba674 (patch) | |
| tree | c9fe4c255d0665067e330918e313f66978749e20 /users | |
| parent | fb739a67c92483f6c072886b9ffbb90e55b6582d (diff) | |
| parent | 5334e087ef848d54266537ecdc0b87cac976517e (diff) | |
| download | qmk_firmware-9e4dd8bfcba41ccac0d28ee8ea218142e7aba674.tar.gz qmk_firmware-9e4dd8bfcba41ccac0d28ee8ea218142e7aba674.zip | |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'users')
| -rw-r--r-- | users/jonavin/jonavin.c | 177 | ||||
| -rw-r--r-- | users/jonavin/jonavin.h | 8 | ||||
| -rw-r--r-- | users/jonavin/jonavin_encoder.c | 219 | ||||
| -rw-r--r-- | users/jonavin/readme.md | 11 | ||||
| -rw-r--r-- | users/jonavin/rules.mk | 11 |
5 files changed, 263 insertions, 163 deletions
diff --git a/users/jonavin/jonavin.c b/users/jonavin/jonavin.c index 367601dfb..b66b444f3 100644 --- a/users/jonavin/jonavin.c +++ b/users/jonavin/jonavin.c | |||
| @@ -95,171 +95,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 95 | } // timeout_threshold = 0 will disable timeout | 95 | } // timeout_threshold = 0 will disable timeout |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | #endif // IDLE_TIMEOUT_ENABLE | ||
| 99 | |||
| 100 | #if defined(ALTTAB_SCROLL_ENABLE) || defined(IDLE_TIMEOUT_ENABLE) // timer features | ||
| 98 | __attribute__((weak)) void matrix_scan_keymap(void) {} | 101 | __attribute__((weak)) void matrix_scan_keymap(void) {} |
| 99 | 102 | ||
| 100 | void matrix_scan_user(void) { | 103 | void matrix_scan_user(void) { |
| 101 | timeout_tick_timer(); | 104 | #ifdef ALTTAB_SCROLL_ENABLE |
| 105 | encoder_tick_alttabscroll(); | ||
| 106 | #endif | ||
| 107 | #ifdef IDLE_TIMEOUT_ENABLE | ||
| 108 | timeout_tick_timer(); | ||
| 109 | #endif | ||
| 102 | matrix_scan_keymap(); | 110 | matrix_scan_keymap(); |
| 103 | } | 111 | } |
| 104 | #endif // IDLE_TIMEOUT_ENABLE | 112 | #endif // ALTTAB_SCROLL_ENABLE or IDLE_TIMEOUT_ENABLE |
| 105 | |||
| 106 | |||
| 107 | #ifdef ENCODER_ENABLE | ||
| 108 | #ifndef DYNAMIC_KEYMAP_LAYER_COUNT | ||
| 109 | #define DYNAMIC_KEYMAP_LAYER_COUNT 4 //default in case this is not already defined elsewhere | ||
| 110 | #endif | ||
| 111 | #ifndef ENCODER_DEFAULTACTIONS_INDEX | ||
| 112 | #define ENCODER_DEFAULTACTIONS_INDEX 0 // can select encoder index if there are multiple encoders | ||
| 113 | #endif | ||
| 114 | |||
| 115 | void encoder_action_volume(bool clockwise) { | ||
| 116 | if (clockwise) | ||
| 117 | tap_code(KC_VOLU); | ||
| 118 | else | ||
| 119 | tap_code(KC_VOLD); | ||
| 120 | } | ||
| 121 | |||
| 122 | void encoder_action_mediatrack(bool clockwise) { | ||
| 123 | if (clockwise) | ||
| 124 | tap_code(KC_MEDIA_NEXT_TRACK); | ||
| 125 | else | ||
| 126 | tap_code(KC_MEDIA_PREV_TRACK); | ||
| 127 | } | ||
| 128 | |||
| 129 | void encoder_action_navword(bool clockwise) { | ||
| 130 | if (clockwise) | ||
| 131 | tap_code16(LCTL(KC_RGHT)); | ||
| 132 | else | ||
| 133 | tap_code16(LCTL(KC_LEFT)); | ||
| 134 | } | ||
| 135 | |||
| 136 | void encoder_action_navpage(bool clockwise) { | ||
| 137 | if (clockwise) | ||
| 138 | tap_code16(KC_PGUP); | ||
| 139 | else | ||
| 140 | tap_code16(KC_PGDN); | ||
| 141 | } | ||
| 142 | |||
| 143 | // LAYER HANDLING | ||
| 144 | uint8_t selected_layer = 0; | ||
| 145 | |||
| 146 | uint8_t get_selected_layer(void) { | ||
| 147 | return selected_layer; | ||
| 148 | } | ||
| 149 | |||
| 150 | void encoder_action_layerchange(bool clockwise) { | ||
| 151 | if (clockwise) { | ||
| 152 | if(selected_layer < (DYNAMIC_KEYMAP_LAYER_COUNT - 1)) { | ||
| 153 | selected_layer ++; | ||
| 154 | layer_move(selected_layer); | ||
| 155 | } | ||
| 156 | } else { | ||
| 157 | if (selected_layer > 0) { | ||
| 158 | selected_layer --; | ||
| 159 | layer_move(selected_layer); | ||
| 160 | } | ||
| 161 | } | ||
| 162 | } | ||
| 163 | |||
| 164 | #ifdef RGB_MATRIX_ENABLE | ||
| 165 | void encoder_action_rgb_speed(bool clockwise) { | ||
| 166 | if (clockwise) | ||
| 167 | rgb_matrix_increase_speed_noeeprom(); | ||
| 168 | else | ||
| 169 | rgb_matrix_decrease_speed_noeeprom(); | ||
| 170 | } | ||
| 171 | void encoder_action_rgb_hue(bool clockwise) { | ||
| 172 | if (clockwise) | ||
| 173 | rgb_matrix_increase_hue_noeeprom(); | ||
| 174 | else | ||
| 175 | rgb_matrix_decrease_hue_noeeprom(); | ||
| 176 | } | ||
| 177 | void encoder_action_rgb_saturation(bool clockwise) { | ||
| 178 | if (clockwise) | ||
| 179 | rgb_matrix_increase_sat_noeeprom(); | ||
| 180 | else | ||
| 181 | rgb_matrix_decrease_sat_noeeprom(); | ||
| 182 | } | ||
| 183 | void encoder_action_rgb_brightness(bool clockwise) { | ||
| 184 | if (clockwise) | ||
| 185 | rgb_matrix_increase_val_noeeprom(); | ||
| 186 | else | ||
| 187 | rgb_matrix_decrease_val_noeeprom(); | ||
| 188 | } | ||
| 189 | void encoder_action_rgb_mode(bool clockwise) { | ||
| 190 | if (clockwise) | ||
| 191 | rgb_matrix_step_noeeprom(); | ||
| 192 | else | ||
| 193 | rgb_matrix_step_reverse_noeeprom(); | ||
| 194 | } | ||
| 195 | #elif defined(RGBLIGHT_ENABLE) | ||
| 196 | void encoder_action_rgb_speed(bool clockwise) { | ||
| 197 | if (clockwise) | ||
| 198 | rgblight_increase_speed_noeeprom(); | ||
| 199 | else | ||
| 200 | rgblight_decrease_speed_noeeprom(); | ||
| 201 | } | ||
| 202 | void encoder_action_rgb_hue(bool clockwise) { | ||
| 203 | if (clockwise) | ||
| 204 | rgblight_increase_hue_noeeprom(); | ||
| 205 | else | ||
| 206 | rgblight_decrease_hue_noeeprom(); | ||
| 207 | } | ||
| 208 | void encoder_action_rgb_saturation(bool clockwise) { | ||
| 209 | if (clockwise) | ||
| 210 | rgblight_increase_sat_noeeprom(); | ||
| 211 | else | ||
| 212 | rgblight_decrease_sat_noeeprom(); | ||
| 213 | } | ||
| 214 | void encoder_action_rgb_brightness(bool clockwise) { | ||
| 215 | if (clockwise) | ||
| 216 | rgblight_increase_val_noeeprom(); | ||
| 217 | else | ||
| 218 | rgblight_decrease_val_noeeprom(); | ||
| 219 | } | ||
| 220 | void encoder_action_rgb_mode(bool clockwise) { | ||
| 221 | if (clockwise) | ||
| 222 | rgblight_step_noeeprom(); | ||
| 223 | else | ||
| 224 | rgblight_step_reverse_noeeprom(); | ||
| 225 | } | ||
| 226 | #endif // RGB_MATRIX_ENABLE || RGBLIGHT_ENABLE | ||
| 227 | #endif // ENCODER_ENABLE | ||
| 228 | |||
| 229 | #if defined(ENCODER_ENABLE) && defined(ENCODER_DEFAULTACTIONS_ENABLE) // Encoder Functionality | ||
| 230 | |||
| 231 | __attribute__((weak)) bool encoder_update_keymap(uint8_t index, bool clockwise) { return true; } | ||
| 232 | |||
| 233 | bool encoder_update_user(uint8_t index, bool clockwise) { | ||
| 234 | if (!encoder_update_keymap(index, clockwise)) { return false; } | ||
| 235 | if (index != ENCODER_DEFAULTACTIONS_INDEX) {return true;} // exit if the index doesn't match | ||
| 236 | uint8_t mods_state = get_mods(); | ||
| 237 | if (mods_state & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers | ||
| 238 | encoder_action_layerchange(clockwise); | ||
| 239 | } else if (mods_state & MOD_BIT(KC_RSFT) ) { // If you are holding R shift, Page up/dn | ||
| 240 | unregister_mods(MOD_BIT(KC_RSFT)); | ||
| 241 | encoder_action_navpage(clockwise); | ||
| 242 | register_mods(MOD_BIT(KC_RSFT)); | ||
| 243 | } else if (mods_state & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next/prev word | ||
| 244 | encoder_action_navword(clockwise); | ||
| 245 | } else if (mods_state & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next/prev track | ||
| 246 | encoder_action_mediatrack(clockwise); | ||
| 247 | } else { | ||
| 248 | switch(get_highest_layer(layer_state)) { | ||
| 249 | case _FN1: | ||
| 250 | #ifdef IDLE_TIMEOUT_ENABLE | ||
| 251 | timeout_update_threshold(clockwise); | ||
| 252 | #endif | ||
| 253 | break; | ||
| 254 | default: | ||
| 255 | encoder_action_volume(clockwise); // Otherwise it just changes volume | ||
| 256 | break; | ||
| 257 | } | ||
| 258 | } | ||
| 259 | return false; | ||
| 260 | } | ||
| 261 | #endif // ENCODER_ENABLE | ||
| 262 | |||
| 263 | 113 | ||
| 264 | // PROCESS KEY CODES | 114 | // PROCESS KEY CODES |
| 265 | __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } | 115 | __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } |
| @@ -326,6 +176,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 326 | break; | 176 | break; |
| 327 | #endif // EMOTICON_ENABLE | 177 | #endif // EMOTICON_ENABLE |
| 328 | 178 | ||
| 179 | #ifdef ALTTAB_SCROLL_ENABLE | ||
| 180 | case KC_TSTOG: | ||
| 181 | if (record->event.pressed) encoder_toggle_alttabscroll(); | ||
| 182 | else unregister_code16(keycode); | ||
| 183 | break; | ||
| 184 | #endif // ALTTAB_SCROLL_ENABLE | ||
| 185 | |||
| 329 | default: | 186 | default: |
| 330 | if (record->event.pressed) { | 187 | if (record->event.pressed) { |
| 331 | #ifdef RGB_MATRIX_ENABLE | 188 | #ifdef RGB_MATRIX_ENABLE |
diff --git a/users/jonavin/jonavin.h b/users/jonavin/jonavin.h index 21b972ed7..ab2ce0dff 100644 --- a/users/jonavin/jonavin.h +++ b/users/jonavin/jonavin.h | |||
| @@ -45,6 +45,8 @@ enum custom_user_keycodes { | |||
| 45 | EMO_JOY, // (^o^) | 45 | EMO_JOY, // (^o^) |
| 46 | EMO_TEARS, // (T_T) | 46 | EMO_TEARS, // (T_T) |
| 47 | 47 | ||
| 48 | KC_TSTOG, // Tab Scroll Toggle | ||
| 49 | |||
| 48 | NEW_SAFE_RANGE // new safe range for keymap level custom keycodes | 50 | NEW_SAFE_RANGE // new safe range for keymap level custom keycodes |
| 49 | }; | 51 | }; |
| 50 | 52 | ||
| @@ -91,6 +93,12 @@ enum custom_user_keycodes { | |||
| 91 | void encoder_action_rgb_brightness(bool clockwise); | 93 | void encoder_action_rgb_brightness(bool clockwise); |
| 92 | void encoder_action_rgb_mode(bool clockwise); | 94 | void encoder_action_rgb_mode(bool clockwise); |
| 93 | #endif // RGB_MATRIX_ENABLE / RGBLIGHT_ENABLE | 95 | #endif // RGB_MATRIX_ENABLE / RGBLIGHT_ENABLE |
| 96 | |||
| 97 | #ifdef ALTTAB_SCROLL_ENABLE | ||
| 98 | void encoder_action_alttabscroll(bool clockwise); | ||
| 99 | void encoder_toggle_alttabscroll(void); | ||
| 100 | void encoder_tick_alttabscroll(void); | ||
| 101 | #endif // ALTTAB_SCROLL_ENABLE | ||
| 94 | #endif // ENCODER_ENABLE | 102 | #endif // ENCODER_ENABLE |
| 95 | 103 | ||
| 96 | 104 | ||
diff --git a/users/jonavin/jonavin_encoder.c b/users/jonavin/jonavin_encoder.c new file mode 100644 index 000000000..387ed5f43 --- /dev/null +++ b/users/jonavin/jonavin_encoder.c | |||
| @@ -0,0 +1,219 @@ | |||
| 1 | |||
| 2 | /* Copyright 2021 Jonavin Eng @Jonavin | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | |||
| 19 | #include QMK_KEYBOARD_H | ||
| 20 | #include "jonavin.h" | ||
| 21 | |||
| 22 | #ifdef ENCODER_ENABLE | ||
| 23 | #ifndef DYNAMIC_KEYMAP_LAYER_COUNT | ||
| 24 | #define DYNAMIC_KEYMAP_LAYER_COUNT 4 //default in case this is not already defined elsewhere | ||
| 25 | #endif | ||
| 26 | #ifndef ENCODER_DEFAULTACTIONS_INDEX | ||
| 27 | #define ENCODER_DEFAULTACTIONS_INDEX 0 // can select encoder index if there are multiple encoders | ||
| 28 | #endif | ||
| 29 | |||
| 30 | void encoder_action_volume(bool clockwise) { | ||
| 31 | if (clockwise) | ||
| 32 | tap_code(KC_VOLU); | ||
| 33 | else | ||
| 34 | tap_code(KC_VOLD); | ||
| 35 | } | ||
| 36 | |||
| 37 | void encoder_action_mediatrack(bool clockwise) { | ||
| 38 | if (clockwise) | ||
| 39 | tap_code(KC_MEDIA_NEXT_TRACK); | ||
| 40 | else | ||
| 41 | tap_code(KC_MEDIA_PREV_TRACK); | ||
| 42 | } | ||
| 43 | |||
| 44 | void encoder_action_navword(bool clockwise) { | ||
| 45 | if (clockwise) | ||
| 46 | tap_code16(LCTL(KC_RGHT)); | ||
| 47 | else | ||
| 48 | tap_code16(LCTL(KC_LEFT)); | ||
| 49 | } | ||
| 50 | |||
| 51 | void encoder_action_navpage(bool clockwise) { | ||
| 52 | if (clockwise) | ||
| 53 | tap_code16(KC_PGUP); | ||
| 54 | else | ||
| 55 | tap_code16(KC_PGDN); | ||
| 56 | } | ||
| 57 | |||
| 58 | // LAYER HANDLING | ||
| 59 | uint8_t selected_layer = 0; | ||
| 60 | |||
| 61 | uint8_t get_selected_layer(void) { | ||
| 62 | return selected_layer; | ||
| 63 | } | ||
| 64 | |||
| 65 | void encoder_action_layerchange(bool clockwise) { | ||
| 66 | if (clockwise) { | ||
| 67 | if(selected_layer < (DYNAMIC_KEYMAP_LAYER_COUNT - 1)) { | ||
| 68 | selected_layer ++; | ||
| 69 | layer_move(selected_layer); | ||
| 70 | } | ||
| 71 | } else { | ||
| 72 | if (selected_layer > 0) { | ||
| 73 | selected_layer --; | ||
| 74 | layer_move(selected_layer); | ||
| 75 | } | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| 79 | #ifdef RGB_MATRIX_ENABLE | ||
| 80 | void encoder_action_rgb_speed(bool clockwise) { | ||
| 81 | if (clockwise) | ||
| 82 | rgb_matrix_increase_speed_noeeprom(); | ||
| 83 | else | ||
| 84 | rgb_matrix_decrease_speed_noeeprom(); | ||
| 85 | } | ||
| 86 | void encoder_action_rgb_hue(bool clockwise) { | ||
| 87 | if (clockwise) | ||
| 88 | rgb_matrix_increase_hue_noeeprom(); | ||
| 89 | else | ||
| 90 | rgb_matrix_decrease_hue_noeeprom(); | ||
| 91 | } | ||
| 92 | void encoder_action_rgb_saturation(bool clockwise) { | ||
| 93 | if (clockwise) | ||
| 94 | rgb_matrix_increase_sat_noeeprom(); | ||
| 95 | else | ||
| 96 | rgb_matrix_decrease_sat_noeeprom(); | ||
| 97 | } | ||
| 98 | void encoder_action_rgb_brightness(bool clockwise) { | ||
| 99 | if (clockwise) | ||
| 100 | rgb_matrix_increase_val_noeeprom(); | ||
| 101 | else | ||
| 102 | rgb_matrix_decrease_val_noeeprom(); | ||
| 103 | } | ||
| 104 | void encoder_action_rgb_mode(bool clockwise) { | ||
| 105 | if (clockwise) | ||
| 106 | rgb_matrix_step_noeeprom(); | ||
| 107 | else | ||
| 108 | rgb_matrix_step_reverse_noeeprom(); | ||
| 109 | } | ||
| 110 | #elif defined(RGBLIGHT_ENABLE) | ||
| 111 | void encoder_action_rgb_speed(bool clockwise) { | ||
| 112 | if (clockwise) | ||
| 113 | rgblight_increase_speed_noeeprom(); | ||
| 114 | else | ||
| 115 | rgblight_decrease_speed_noeeprom(); | ||
| 116 | } | ||
| 117 | void encoder_action_rgb_hue(bool clockwise) { | ||
| 118 | if (clockwise) | ||
| 119 | rgblight_increase_hue_noeeprom(); | ||
| 120 | else | ||
| 121 | rgblight_decrease_hue_noeeprom(); | ||
| 122 | } | ||
| 123 | void encoder_action_rgb_saturation(bool clockwise) { | ||
| 124 | if (clockwise) | ||
| 125 | rgblight_increase_sat_noeeprom(); | ||
| 126 | else | ||
| 127 | rgblight_decrease_sat_noeeprom(); | ||
| 128 | } | ||
| 129 | void encoder_action_rgb_brightness(bool clockwise) { | ||
| 130 | if (clockwise) | ||
| 131 | rgblight_increase_val_noeeprom(); | ||
| 132 | else | ||
| 133 | rgblight_decrease_val_noeeprom(); | ||
| 134 | } | ||
| 135 | void encoder_action_rgb_mode(bool clockwise) { | ||
| 136 | if (clockwise) | ||
| 137 | rgblight_step_noeeprom(); | ||
| 138 | else | ||
| 139 | rgblight_step_reverse_noeeprom(); | ||
| 140 | } | ||
| 141 | #endif // RGB_MATRIX_ENABLE || RGBLIGHT_ENABLE | ||
| 142 | |||
| 143 | #ifdef ALTTAB_SCROLL_ENABLE | ||
| 144 | bool is_tab_scrolling = false; | ||
| 145 | bool is_alt_tab_active = false; | ||
| 146 | uint16_t alt_tab_timer = 0; | ||
| 147 | |||
| 148 | |||
| 149 | void encoder_toggle_alttabscroll(void) { | ||
| 150 | is_tab_scrolling = !is_tab_scrolling; | ||
| 151 | } | ||
| 152 | |||
| 153 | void encoder_action_alttabscroll(bool clockwise) { | ||
| 154 | if (clockwise) { | ||
| 155 | if (!is_alt_tab_active) { | ||
| 156 | is_alt_tab_active = true; | ||
| 157 | register_mods(MOD_RALT); | ||
| 158 | } | ||
| 159 | tap_code16(KC_TAB); | ||
| 160 | } | ||
| 161 | else { | ||
| 162 | tap_code16(S(KC_TAB)); | ||
| 163 | } | ||
| 164 | alt_tab_timer = timer_read(); | ||
| 165 | } | ||
| 166 | |||
| 167 | void encoder_tick_alttabscroll(void) { | ||
| 168 | if (is_alt_tab_active) { | ||
| 169 | if (timer_elapsed(alt_tab_timer) > 600) { | ||
| 170 | unregister_mods(MOD_RALT); | ||
| 171 | is_alt_tab_active = false; | ||
| 172 | } | ||
| 173 | } | ||
| 174 | } | ||
| 175 | #endif // ALTTAB_SCROLL_ENABLE | ||
| 176 | #endif // ENCODER_ENABLE | ||
| 177 | |||
| 178 | #if defined(ENCODER_ENABLE) && defined(ENCODER_DEFAULTACTIONS_ENABLE) // Encoder Functionality | ||
| 179 | |||
| 180 | __attribute__((weak)) bool encoder_update_keymap(uint8_t index, bool clockwise) { return true; } | ||
| 181 | |||
| 182 | bool encoder_update_user(uint8_t index, bool clockwise) { | ||
| 183 | if (!encoder_update_keymap(index, clockwise)) { return false; } | ||
| 184 | if (index != ENCODER_DEFAULTACTIONS_INDEX) {return true;} // exit if the index doesn't match | ||
| 185 | uint8_t mods_state = get_mods(); | ||
| 186 | if (mods_state & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers | ||
| 187 | encoder_action_layerchange(clockwise); | ||
| 188 | } else if (mods_state & MOD_BIT(KC_RSFT) ) { // If you are holding R shift, Page up/dn | ||
| 189 | unregister_mods(MOD_BIT(KC_RSFT)); | ||
| 190 | encoder_action_navpage(clockwise); | ||
| 191 | register_mods(MOD_BIT(KC_RSFT)); | ||
| 192 | } else if (mods_state & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next/prev word | ||
| 193 | encoder_action_navword(clockwise); | ||
| 194 | } else if (mods_state & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next/prev track | ||
| 195 | encoder_action_mediatrack(clockwise); | ||
| 196 | } else { | ||
| 197 | switch(get_highest_layer(layer_state)) { | ||
| 198 | case _FN1: | ||
| 199 | #ifdef IDLE_TIMEOUT_ENABLE | ||
| 200 | timeout_update_threshold(clockwise); | ||
| 201 | #endif | ||
| 202 | break; | ||
| 203 | default: | ||
| 204 | #ifdef ALTTAB_SCROLL_ENABLE | ||
| 205 | if (is_tab_scrolling) | ||
| 206 | encoder_action_alttabscroll(clockwise); | ||
| 207 | else | ||
| 208 | encoder_action_volume(clockwise); // Otherwise it just changes volume | ||
| 209 | #else | ||
| 210 | encoder_action_volume(clockwise); // Otherwise it just changes volume | ||
| 211 | #endif // ALTTAB_SCROLL_ENABLE | ||
| 212 | break; | ||
| 213 | } | ||
| 214 | } | ||
| 215 | return false; | ||
| 216 | } | ||
| 217 | #endif // ENCODER_ENABLE | ||
| 218 | |||
| 219 | |||
diff --git a/users/jonavin/readme.md b/users/jonavin/readme.md index 1b064ddc3..8ec0e0ea1 100644 --- a/users/jonavin/readme.md +++ b/users/jonavin/readme.md | |||
| @@ -35,6 +35,7 @@ KEYCODES: | |||
| 35 | - KC_SFTUP RShift when held, Up arrow when tapped | 35 | - KC_SFTUP RShift when held, Up arrow when tapped |
| 36 | - KC_RAISESPC _RAISE layer mod when held, space when tapped | 36 | - KC_RAISESPC _RAISE layer mod when held, space when tapped |
| 37 | - KC_LOWERSPC _LOWER layer mod when held, space when tapped | 37 | - KC_LOWERSPC _LOWER layer mod when held, space when tapped |
| 38 | - KC_TSTOG toggles between volume and Alt-Tab encoder control | ||
| 38 | - | 39 | - |
| 39 | When EMOTICON_ENABLE = yes | 40 | When EMOTICON_ENABLE = yes |
| 40 | - EMO_SHRUG `\_("/)_/` | 41 | - EMO_SHRUG `\_("/)_/` |
| @@ -59,7 +60,9 @@ AVAILABLE ENCODER ACTIONS: | |||
| 59 | - void encoder_action_rgb_saturation(bool clockwise); | 60 | - void encoder_action_rgb_saturation(bool clockwise); |
| 60 | - void encoder_action_rgb_brightness(bool clockwise); | 61 | - void encoder_action_rgb_brightness(bool clockwise); |
| 61 | - void encoder_action_rgb_mode(bool clockwise); | 62 | - void encoder_action_rgb_mode(bool clockwise); |
| 62 | 63 | - | |
| 64 | - void encoder_action_alttabscroll(bool clockwise) | ||
| 65 | - void encoder_toggle_alttabscroll(void); | ||
| 63 | 66 | ||
| 64 | ENABLE FEATURES your keymap rules.mk | 67 | ENABLE FEATURES your keymap rules.mk |
| 65 | --------------------------------------- | 68 | --------------------------------------- |
| @@ -89,6 +92,12 @@ EMOTICON_ENABLE | |||
| 89 | INVERT_NUMLOCK_INDICATOR | 92 | INVERT_NUMLOCK_INDICATOR |
| 90 | - inverts the Num lock indicator, LED is on when num lock is off | 93 | - inverts the Num lock indicator, LED is on when num lock is off |
| 91 | 94 | ||
| 95 | ALTTAB_SCROLL_ENABLE | ||
| 96 | - When ENCODER_DEFAULTACTIONS_ENABLE = yes, | ||
| 97 | Enables Alt-Tab scrolling functions in default encoder, | ||
| 98 | bind KS_TSTOG to a key to enable/disable Alt-Tab vs Volume control | ||
| 99 | - When defining your own encoder functions use encoder_action_alttabscroll(bool clockwise) to assign the encodr action | ||
| 100 | |||
| 92 | 101 | ||
| 93 | FUNCTIONS | 102 | FUNCTIONS |
| 94 | ------------------------ | 103 | ------------------------ |
diff --git a/users/jonavin/rules.mk b/users/jonavin/rules.mk index 646002124..4f65db27b 100644 --- a/users/jonavin/rules.mk +++ b/users/jonavin/rules.mk | |||
| @@ -1,6 +1,13 @@ | |||
| 1 | SRC += jonavin.c | 1 | SRC += jonavin.c |
| 2 | ifeq ($(strip $(ENCODER_DEFAULTACTIONS_ENABLE)), yes) | 2 | ifdef ENCODER_ENABLE |
| 3 | OPT_DEFS += -DENCODER_DEFAULTACTIONS_ENABLE | 3 | # include encoder related code when enabled |
| 4 | ifeq ($(strip $(ENCODER_DEFAULTACTIONS_ENABLE)), yes) | ||
| 5 | OPT_DEFS += -DENCODER_DEFAULTACTIONS_ENABLE | ||
| 6 | endif | ||
| 7 | ifeq ($(strip $(ALTTAB_SCROLL_ENABLE)), yes) | ||
| 8 | OPT_DEFS += -DALTTAB_SCROLL_ENABLE | ||
| 9 | endif | ||
| 10 | SRC += jonavin_encoder.c | ||
| 4 | endif | 11 | endif |
| 5 | ifeq ($(strip $(TD_LSFT_CAPSLOCK_ENABLE)), yes) | 12 | ifeq ($(strip $(TD_LSFT_CAPSLOCK_ENABLE)), yes) |
| 6 | OPT_DEFS += -DTD_LSFT_CAPSLOCK_ENABLE | 13 | OPT_DEFS += -DTD_LSFT_CAPSLOCK_ENABLE |
