diff options
| author | Konstantin Đorđević <konstantin.djordjevic@tradecore.com> | 2019-07-25 21:31:40 +0200 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-07-25 12:31:40 -0700 |
| commit | 36d3902504d6aa0d2bdac88c90339c902ade11b3 (patch) | |
| tree | b4a36c6b3cb5d54f44680df60c1845e8cb917197 /users/konstantin/konstantin.c | |
| parent | f204ed67f210b1dde20333727c79c47a5b70518a (diff) | |
| download | qmk_firmware-36d3902504d6aa0d2bdac88c90339c902ade11b3.tar.gz qmk_firmware-36d3902504d6aa0d2bdac88c90339c902ade11b3.zip | |
[User] Update personal userspace and keymaps, add reactive underglow (#6410)
* Update MODERN_DOLCH_RED color
* Remove unused RAL_LAL tap dance
* Disable Space Cadet on all boards
* Rework SEND_STRING_CLEAN into CLEAN_MODS, fix DST_P_R/DST_N_A
* Disable unnecessary underglow animations
* Rearrange feature flags in rules.mk files
* Change custom colors from structs to defines
* Add some explicit initializers
* Add MODERN_DOLCH_CYAN color
* Add IS_LAYER_ON_STATE()/IS_LAYER_OFF_STATE() macros
* Add led_set_keymap() template function
* Change underglow color based on Caps/Fn state
* Preserve val when changing underglow colors
* Only trigger Fn light for Fn layer
* Refactor fn_light() and caps_light() slightly
* Add comments to fn_light() and caps_light()
Diffstat (limited to 'users/konstantin/konstantin.c')
| -rw-r--r-- | users/konstantin/konstantin.c | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index 9e3caca41..c56c9490f 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c | |||
| @@ -32,26 +32,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | switch (keycode) { | 34 | switch (keycode) { |
| 35 | case CLEAR: | 35 | uint16_t kc; |
| 36 | if (record->event.pressed) { | ||
| 37 | SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE)); | ||
| 38 | } | ||
| 39 | return false; | ||
| 40 | |||
| 41 | case DST_P_R: | ||
| 42 | (record->event.pressed ? register_code16 : unregister_code16)( | ||
| 43 | (get_mods() & DST_MOD_MASK) ? DST_REM : DST_PRV | ||
| 44 | ); | ||
| 45 | return false; | ||
| 46 | |||
| 47 | case DST_N_A: | ||
| 48 | (record->event.pressed ? register_code16 : unregister_code16)( | ||
| 49 | (get_mods() & DST_MOD_MASK) ? DST_ADD : DST_NXT | ||
| 50 | ); | ||
| 51 | return false; | ||
| 52 | |||
| 53 | #ifdef LAYER_FN | 36 | #ifdef LAYER_FN |
| 54 | static bool fn_lock; | 37 | static bool fn_lock = false; |
| 55 | 38 | ||
| 56 | case FN_FNLK: | 39 | case FN_FNLK: |
| 57 | if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) { | 40 | if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) { |
| @@ -77,6 +60,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 77 | } | 60 | } |
| 78 | return true; | 61 | return true; |
| 79 | 62 | ||
| 63 | case CLEAR: | ||
| 64 | if (record->event.pressed) { | ||
| 65 | CLEAN_MODS( | ||
| 66 | SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE)); | ||
| 67 | ) | ||
| 68 | } | ||
| 69 | return false; | ||
| 70 | |||
| 71 | case DST_P_R: | ||
| 72 | kc = (get_mods() & DST_MOD_MASK) ? DST_REM : DST_PRV; | ||
| 73 | CLEAN_MODS( | ||
| 74 | (record->event.pressed ? register_code16 : unregister_code16)(kc); | ||
| 75 | ) | ||
| 76 | return false; | ||
| 77 | |||
| 78 | case DST_N_A: | ||
| 79 | kc = (get_mods() & DST_MOD_MASK) ? DST_ADD : DST_NXT; | ||
| 80 | CLEAN_MODS( | ||
| 81 | (record->event.pressed ? register_code16 : unregister_code16)(kc); | ||
| 82 | ) | ||
| 83 | return false; | ||
| 84 | |||
| 80 | default: | 85 | default: |
| 81 | return true; | 86 | return true; |
| 82 | } | 87 | } |
| @@ -91,7 +96,7 @@ uint32_t layer_state_set_user(uint32_t state) { | |||
| 91 | state = layer_state_set_keymap(state); | 96 | state = layer_state_set_keymap(state); |
| 92 | 97 | ||
| 93 | #ifdef LAYER_NUMPAD | 98 | #ifdef LAYER_NUMPAD |
| 94 | bool numpad = state & 1UL<<L_NUMPAD; | 99 | bool numpad = IS_LAYER_ON_STATE(state, L_NUMPAD); |
| 95 | bool num_lock = IS_HOST_LED_ON(USB_LED_NUM_LOCK); | 100 | bool num_lock = IS_HOST_LED_ON(USB_LED_NUM_LOCK); |
| 96 | if (numpad != num_lock) { | 101 | if (numpad != num_lock) { |
| 97 | tap_code(KC_NLCK); // Toggle Num Lock to match Numpad layer state | 102 | tap_code(KC_NLCK); // Toggle Num Lock to match Numpad layer state |
| @@ -100,3 +105,10 @@ uint32_t layer_state_set_user(uint32_t state) { | |||
| 100 | 105 | ||
| 101 | return state; | 106 | return state; |
| 102 | } | 107 | } |
| 108 | |||
| 109 | __attribute__((weak)) | ||
| 110 | void led_set_keymap(uint8_t usb_led) {} | ||
| 111 | |||
| 112 | void led_set_user(uint8_t usb_led) { | ||
| 113 | led_set_keymap(usb_led); | ||
| 114 | } | ||
