diff options
| author | Jonathan Rascher <jon@bcat.name> | 2020-07-10 17:57:49 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-10 22:57:49 +0100 |
| commit | 027570a21b44b2cba1b917c2eddb804b5dc82173 (patch) | |
| tree | 6ed2111c9e65a1e38a855de490f7d359ba2e0306 /users/bcat/bcat.c | |
| parent | bd72a577a2bec7479a909316d1729bad41c0b0e5 (diff) | |
| download | qmk_firmware-027570a21b44b2cba1b917c2eddb804b5dc82173.tar.gz qmk_firmware-027570a21b44b2cba1b917c2eddb804b5dc82173.zip | |
Rework bcat Crkbd and Lily58 modifier keys (#9692)
* Re-enable mouse keys to fix Chrome OS media keys
I'm not sure if there's a bug in Chrome OS, QMK, or both, but
EXTRAKEY_ENABLE isn't sufficient for media keys to work on Chrome OS.
Instead, MOUSEKEY_ENABLE is also required.
* Remove unnecessary SPLIT_USB_DETECT for Lily58
I've since swapped my Lily58 back to Elite-C v2 controllers with working
VBUS detection.
* Move Crkbd Esc and Ctrl keys; add some shortcuts
* Move MC_ALTT to userspace for cross-board support
* Sync Lily58 keymap with Crkbd
* Fix typos
Diffstat (limited to 'users/bcat/bcat.c')
| -rw-r--r-- | users/bcat/bcat.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/users/bcat/bcat.c b/users/bcat/bcat.c index 2b250c10f..397d565da 100644 --- a/users/bcat/bcat.c +++ b/users/bcat/bcat.c | |||
| @@ -1,6 +1,43 @@ | |||
| 1 | #include "quantum.h" | 1 | #include "bcat.h" |
| 2 | 2 | ||
| 3 | #if defined(RGBLIGHT_ENABLE) | 3 | #if defined(RGBLIGHT_ENABLE) |
| 4 | /* Adjust RGB static hue ranges for shorter gradients than default. */ | 4 | /* Adjust RGB static hue ranges for shorter gradients than default. */ |
| 5 | const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 127, 63, 31, 15}; | 5 | const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 127, 63, 31, 15}; |
| 6 | #endif | 6 | #endif |
| 7 | |||
| 8 | static int8_t alt_tab_layer = -1; | ||
| 9 | |||
| 10 | __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } | ||
| 11 | |||
| 12 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 13 | if (!process_record_keymap(keycode, record)) { | ||
| 14 | return false; | ||
| 15 | } | ||
| 16 | switch (keycode) { | ||
| 17 | /* Alt+Tab that holds Alt until current layer is released: */ | ||
| 18 | case MC_ALTT: | ||
| 19 | if (record->event.pressed) { | ||
| 20 | if (alt_tab_layer < 0) { | ||
| 21 | alt_tab_layer = layer_switch_get_layer(record->event.key); | ||
| 22 | register_code(KC_LALT); | ||
| 23 | } | ||
| 24 | register_code(KC_TAB); | ||
| 25 | } else { | ||
| 26 | unregister_code(KC_TAB); | ||
| 27 | } | ||
| 28 | return false; | ||
| 29 | default: | ||
| 30 | return true; | ||
| 31 | } | ||
| 32 | } | ||
| 33 | |||
| 34 | __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } | ||
| 35 | |||
| 36 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 37 | state = layer_state_set_keymap(state); | ||
| 38 | if (alt_tab_layer >= 0 && !layer_state_cmp(state, alt_tab_layer)) { | ||
| 39 | unregister_code(KC_LALT); | ||
| 40 | alt_tab_layer = -1; | ||
| 41 | } | ||
| 42 | return state; | ||
| 43 | } | ||
