66 lines
2.1 KiB
C
66 lines
2.1 KiB
C
/* Copyright 2026 Matej Janežič
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "matej.h"
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
switch (keycode) {
|
|
case M_DSC_SEP:
|
|
if (record->event.pressed) {
|
|
SEND_STRING(SS_LSFT(SS_TAP(X_SCLN)) SS_DELAY(100) SS_LSFT(SS_TAP(X_MINUS)) SS_DELAY(100) SS_LSFT(SS_TAP(X_MINUS)) SS_DELAY(100) SS_LSFT(SS_TAP(X_SCLN)) SS_DELAY(100) SS_TAP(X_ENTER));
|
|
}
|
|
return false;
|
|
case M_BASE_PEEK:
|
|
if (record->event.pressed)
|
|
layer_off(_GAME);
|
|
else
|
|
layer_on(_GAME);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void keyboard_post_init_user(void) {
|
|
rgb_matrix_enable();
|
|
}
|
|
|
|
extern rgb_config_t rgb_matrix_config;
|
|
|
|
static void set_layer_color_hsv(uint8_t h, uint8_t s, uint8_t v) {
|
|
HSV hsv = {h, s, v};
|
|
RGB rgb = hsv_to_rgb(hsv);
|
|
uint8_t scale = rgb_matrix_config.hsv.v;
|
|
rgb_matrix_set_color_all((rgb.r * scale) / 255, (rgb.g * scale) / 255, (rgb.b * scale) / 255);
|
|
}
|
|
|
|
bool rgb_matrix_indicators_user(void) {
|
|
switch (get_highest_layer(layer_state)) {
|
|
case _BASE:
|
|
set_layer_color_hsv(74, 218, 204);
|
|
break;
|
|
case _FN:
|
|
set_layer_color_hsv(41, 255, 255);
|
|
break;
|
|
case _NAV:
|
|
set_layer_color_hsv(152, 255, 255);
|
|
break;
|
|
case _GAME:
|
|
set_layer_color_hsv(0, 255, 200);
|
|
break;
|
|
}
|
|
return true;
|
|
}
|