forked from qmk/qmk_userspace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_user_scripting - via.c
48 lines (42 loc) · 1.17 KB
/
custom_user_scripting - via.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef DIABLO_PLAYERS_CHANGE_ENABLED
if (!process_diablo_player_change(keycode, record)) {
return false;
}
#endif
#ifdef QUICK_GAME_TYPE_ENABLED
if (!process_quick_game_type(keycode, record)) {
return false;
}
#endif
#ifdef REPEAT_ENABLED
if (user_config.repeat_enabled && !process_repeat_key(keycode, record)) {
return false;
}
#endif
#ifdef MOD_SPOOF_ENABLED
if (!process_mod_spoof(keycode, record)) {
return false;
}
#endif
return true;
};
void caps_activated_script(void) {
if (user_config.caps_twinkle) {
rgblight_mode(RGBLIGHT_MODE_TWINKLE);
}
rgblight_sethsv(user_config.caps_hue, 255, user_lighting.led_brightness);
}
void caps_deactivated_script(void) {
rgblight_mode(LAYER_LIGHT_MODE);
update_led_colors();
}
bool led_update_user(led_t led_state) {
static uint8_t caps_state = 0;
if (user_config.caps_flash_enabled && caps_state != led_state.caps_lock) {
led_state.caps_lock ? caps_activated_script() : caps_deactivated_script();
caps_state = led_state.caps_lock;
}
return true;
}