aboutsummaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/bcat/bcat.c39
-rw-r--r--users/bcat/bcat.h8
-rw-r--r--users/bcat/rules.mk5
3 files changed, 49 insertions, 3 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. */
5const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 127, 63, 31, 15}; 5const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 127, 63, 31, 15};
6#endif 6#endif
7
8static int8_t alt_tab_layer = -1;
9
10__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
11
12bool 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
36layer_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}
diff --git a/users/bcat/bcat.h b/users/bcat/bcat.h
new file mode 100644
index 000000000..1ea05e5fa
--- /dev/null
+++ b/users/bcat/bcat.h
@@ -0,0 +1,8 @@
1#pragma once
2
3#include "quantum.h"
4
5enum user_keycodes {
6 MC_ALTT = SAFE_RANGE,
7 KEYMAP_SAFE_RANGE,
8};
diff --git a/users/bcat/rules.mk b/users/bcat/rules.mk
index f3c6f9ab2..f979c703f 100644
--- a/users/bcat/rules.mk
+++ b/users/bcat/rules.mk
@@ -3,8 +3,10 @@ SRC += bcat.c
3# Enable Bootmagic Lite to consistently reset to bootloader and clear EEPROM. 3# Enable Bootmagic Lite to consistently reset to bootloader and clear EEPROM.
4BOOTMAGIC_ENABLE = lite 4BOOTMAGIC_ENABLE = lite
5 5
6# Enable media keys on all keyboards. 6# Enable media keys on all keyboards. (Even though I don't use mouse keys, they
7# seem to be required for media keys to register on Chrome OS.)
7EXTRAKEY_ENABLE = yes 8EXTRAKEY_ENABLE = yes
9MOUSEKEY_ENABLE = yes
8 10
9# Enable link-time optimization to reduce binary size. 11# Enable link-time optimization to reduce binary size.
10LINK_TIME_OPTIMIZATION_ENABLE = yes 12LINK_TIME_OPTIMIZATION_ENABLE = yes
@@ -12,7 +14,6 @@ LINK_TIME_OPTIMIZATION_ENABLE = yes
12# Disable unused build options on all keyboards. 14# Disable unused build options on all keyboards.
13COMMAND_ENABLE = no 15COMMAND_ENABLE = no
14CONSOLE_ENABLE = no 16CONSOLE_ENABLE = no
15MOUSEKEY_ENABLE = no
16NKRO_ENABLE = no 17NKRO_ENABLE = no
17TERMINAL_ENABLE = no 18TERMINAL_ENABLE = no
18 19