Skip to content

Commit 9e4dd8b

Browse files
committed
Merge remote-tracking branch 'origin/master' into develop
2 parents fb739a6 + 5334e08 commit 9e4dd8b

File tree

8 files changed

+271
-165
lines changed

8 files changed

+271
-165
lines changed

keyboards/mechwild/obe/keymaps/jonavin/keymap.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
2626
/* Base */
2727
[_BASE] = LAYOUT(
28-
KC_MUTE, KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_DEL,
28+
KC_TSTOG,KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_DEL,
2929
KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC,
3030
KC_PGDN, TT(_RAISE), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
3131
KC_LSFTCAPSWIN,KC_Z, KC_X, KC_C, KC_V, KC_B, LT(_LOWER,KC_B), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_SFTUP,KC_RSFT,
3232
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FN1), KC_RAISESPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
3333
),
3434
[_FN1] = LAYOUT(
35-
KC_NO, KC_ESC, 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_TRNS, KC_INS,
35+
KC_MUTE, KC_ESC, 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_TRNS, KC_INS,
3636
KC_HOME, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PSCR, KC_SLCK, KC_PAUS, KC_NO, KC_NO, KC_NO, RESET,
3737
KC_END, KC_CAPS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS,
3838
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NLCK, KC_NO, KC_NO, KC_NO, KC_NO, KC_PGUP, KC_TRNS,

keyboards/mechwild/obe/keymaps/jonavin/readme.md

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Features
1818
- left spacebar Backspace
1919
- add double tap of Left Shift to toggle Caps Lock
2020
- Up arrow is also Shift when held
21+
- Pushing the encoder switches the default encoder scroll between volume control and Alt-Tab
2122

2223

2324
rules.mk OPTIONS - Active features from userspace
@@ -46,5 +47,8 @@ EMOTICON_ENABLE
4647
INVERT_NUMLOCK_INDICATOR
4748
- inverts the Num lock indicator, LED is on when num lokc is off
4849

50+
ALTTAB_SCROLL_ENABLE
51+
- bind KS_TSTOG to a different key to change how this toggle happens
52+
4953
## All layers diagram
5054
![image](https://user-images.githubusercontent.com/71780717/137356366-6b23c71b-9499-473e-a1e3-c65644135fc6.png)

keyboards/mechwild/obe/keymaps/jonavin/rules.mk

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ STARTUP_NUMLOCK_ON = yes
1010
ENCODER_DEFAULTACTIONS_ENABLE = yes
1111
EMOTICON_ENABLE = yes
1212
INVERT_NUMLOCK_INDICATOR = yes
13+
14+
ALTTAB_SCROLL_ENABLE = yes

users/jonavin/jonavin.c

+17-160
Original file line numberDiff line numberDiff line change
@@ -95,171 +95,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
9595
} // timeout_threshold = 0 will disable timeout
9696
}
9797

98+
#endif // IDLE_TIMEOUT_ENABLE
99+
100+
#if defined(ALTTAB_SCROLL_ENABLE) || defined(IDLE_TIMEOUT_ENABLE) // timer features
98101
__attribute__((weak)) void matrix_scan_keymap(void) {}
99102

100103
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
102110
matrix_scan_keymap();
103111
}
104-
#endif // 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-
112+
#endif // ALTTAB_SCROLL_ENABLE or IDLE_TIMEOUT_ENABLE
263113

264114
// PROCESS KEY CODES
265115
__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) {
326176
break;
327177
#endif // EMOTICON_ENABLE
328178

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+
329186
default:
330187
if (record->event.pressed) {
331188
#ifdef RGB_MATRIX_ENABLE

users/jonavin/jonavin.h

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ enum custom_user_keycodes {
4545
EMO_JOY, // (^o^)
4646
EMO_TEARS, // (T_T)
4747

48+
KC_TSTOG, // Tab Scroll Toggle
49+
4850
NEW_SAFE_RANGE // new safe range for keymap level custom keycodes
4951
};
5052

@@ -91,6 +93,12 @@ enum custom_user_keycodes {
9193
void encoder_action_rgb_brightness(bool clockwise);
9294
void encoder_action_rgb_mode(bool clockwise);
9395
#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
94102
#endif // ENCODER_ENABLE
95103

96104

0 commit comments

Comments
 (0)