13 #ifdef RGBLIGHT_ENABLE
26 // Enabled by adding a non-tracked secrets.h to this dir.
27 #if (__has_include("secrets.h"))
35 float tone_game[][2] = SONG(ZELDA_PUZZLE);
36 float tone_return[][2] = SONG(ZELDA_TREASURE);
37 float tone_linux[][2] = SONG(UNICODE_LINUX);
38 float tone_windows[][2] = SONG(UNICODE_WINDOWS);
41 /*-------------------*\
42 |*-----TAP-DANCE-----*|
43 \*-------------------*/
44 #ifdef TAP_DANCE_ENABLE
45 qk_tap_dance_action_t tap_dance_actions[] = {
46 // Shift on double tap of semicolon
47 [SCL] = ACTION_TAP_DANCE_DOUBLE( KC_SCLN, KC_COLN )
51 /* In keymaps, instead of writing _user functions, write _keymap functions
52 * The __attribute__((weak)) allows for empty definitions here, and during
53 * compilation, if these functions are defined elsewhere, they are written
54 * over. This allows to include custom code from keymaps in the generic code
57 __attribute__ ((weak)) void matrix_init_keymap(void) { }
58 __attribute__ ((weak)) void matrix_scan_keymap(void) { }
59 __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
62 __attribute__ ((weak)) uint32_t layer_state_set_keymap (uint32_t state) {
65 __attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) { }
67 /* ----------------------- *\
68 * -----RGB Functions----- *
69 \* ----------------------- */
70 #ifdef RGBLIGHT_ENABLE
72 // Set RGBLIGHT state depending on layer
73 void rgblight_change( uint8_t this_layer ) {
74 // Enable RGB light; will not work without this
75 //rgblight_enable_noeeprom();
77 switch ( this_layer ) {
80 rgblight_disable_noeeprom();
83 // Do yellow for alternate
84 rgblight_enable_noeeprom();
85 rgblight_sethsv_noeeprom( 60,255,255);
91 rgblight_enable_noeeprom();
92 rgblight_sethsv_noeeprom(285,255,255);
97 // Do azure for number
98 rgblight_enable_noeeprom();
99 rgblight_sethsv_noeeprom(186,200,255);
104 // Do red for settings
105 rgblight_enable_noeeprom();
107 rgblight_sethsv_noeeprom( 16,255,255);
111 // Do green for mouse
112 rgblight_enable_noeeprom();
113 rgblight_sethsv_noeeprom(120,255,255);
118 // Do orange for music
120 rgblight_enable_noeeprom();
121 rgblight_sethsv_noeeprom( 39,255,255);
125 // Something went wrong
126 rgblight_enable_noeeprom();
127 rgblight_sethsv_noeeprom( 0,255,255);
135 /*---------------------*\
136 |*-----MATRIX INIT-----*|
137 \*---------------------*/
138 void matrix_init_user (void) {
140 // Keymap specific things, do it first thing to allow for delays etc
141 matrix_init_keymap();
144 #ifdef UNICODE_ENABLE
145 set_unicode_input_mode(UC_LNX);
148 // Make beginning layer DVORAK
149 set_single_persistent_default_layer(_DV);
153 /*---------------------*\
154 |*-----MATRIX SCAN-----*|
155 \*---------------------*/
156 void matrix_scan_user (void) {
157 // Keymap specific, do it first
158 matrix_scan_keymap();
161 /*------------------*\
162 |*-----KEYCODES-----*|
163 \*------------------*/
164 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
167 bool is_capital = ( keyboard_report->mods & (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)) );
168 static bool lock_flag = false;
169 uint8_t layer = biton32 (layer_state);
172 // Secrets implementation
173 #if (__has_include("secrets.h"))
175 if( !record->event.pressed ) {
176 send_string_P( secret[ keycode - SECRET1 ] );
181 if( !record->event.pressed ) {
182 send_string_P( secret[ keycode - SECRET2 ] );
187 if( !record->event.pressed ) {
188 send_string_P( secret[ keycode - SECRET3 ] );
194 // Lock functionality: These layers are locked if the LOCKED buttons are
195 // pressed. Otherwise, they are momentary toggles
197 if (record->event.pressed) {
198 lock_flag = !lock_flag;
203 if (record->event.pressed) {
216 if (record->event.pressed) {
229 // Layer switches with sound
231 if (record->event.pressed) {
232 // On press, turn off layer if active
233 if ( layer == _GA ) {
236 PLAY_SONG(tone_return);
241 // After click, turn on layer if accessed from setting
242 if ( layer == _SE ) {
245 PLAY_SONG(tone_game);
254 if (record->event.pressed) {
255 // On press, turn off layer if active
256 if ( layer == _SE ) {
267 // Unicode switches with sound
268 #ifdef UNICODE_ENABLE
270 if (record->event.pressed) {
273 PLAY_SONG(tone_linux);
275 set_unicode_input_mode(UC_LNX);
280 if (record->event.pressed) {
283 PLAY_SONG(tone_windows);
285 set_unicode_input_mode(UC_WIN);
290 // Turkish letters, with capital functionality
292 if (record->event.pressed) {
294 unicode_input_start();
295 register_hex(0x00c2);
296 unicode_input_finish();
298 unicode_input_start();
299 register_hex(0x00e2);
300 unicode_input_finish();
306 if (record->event.pressed) {
308 unicode_input_start();
309 register_hex(0x00d6);
310 unicode_input_finish();
312 unicode_input_start();
313 register_hex(0x00f6);
314 unicode_input_finish();
320 if (record->event.pressed) {
322 unicode_input_start();
323 register_hex(0x00dc);
324 unicode_input_finish();
326 unicode_input_start();
327 register_hex(0x00fc);
328 unicode_input_finish();
334 if (record->event.pressed) {
336 unicode_input_start();
337 register_hex(0x0130);
338 unicode_input_finish();
340 unicode_input_start();
341 register_hex(0x0131);
342 unicode_input_finish();
348 if (record->event.pressed) {
350 unicode_input_start();
351 register_hex(0x011e);
352 unicode_input_finish();
354 unicode_input_start();
355 register_hex(0x011f);
356 unicode_input_finish();
362 if (record->event.pressed) {
364 unicode_input_start();
365 register_hex(0x00c7);
366 unicode_input_finish();
368 unicode_input_start();
369 register_hex(0x00e7);
370 unicode_input_finish();
376 if (record->event.pressed) {
378 unicode_input_start();
379 register_hex(0x015e);
380 unicode_input_finish();
382 unicode_input_start();
383 register_hex(0x015f);
384 unicode_input_finish();
391 //-------Diagonal mouse movements
392 #ifdef MOUSEKEY_ENABLE
394 if( record->event.pressed ) {
406 if( record->event.pressed ) {
418 if( record->event.pressed ) {
430 if( record->event.pressed ) {
442 if( record->event.pressed ) {
447 mousekey_off(MO_S_N);
448 mousekey_off(MO_S_E);
454 if( record->event.pressed ) {
459 mousekey_off(MO_S_N);
460 mousekey_off(MO_S_W);
466 if( record->event.pressed ) {
471 mousekey_off(MO_S_S);
472 mousekey_off(MO_S_E);
478 if( record->event.pressed ) {
483 mousekey_off(MO_S_S);
484 mousekey_off(MO_S_W);
491 //------DOUBLE PRESS, with added left navigation
493 if( record->event.pressed ) {
494 SEND_STRING(" "SS_TAP(X_LEFT));
499 if( record->event.pressed ) {
500 SEND_STRING("<>"SS_TAP(X_LEFT));
505 if( record->event.pressed ) {
506 SEND_STRING("()"SS_TAP(X_LEFT));
511 if( record->event.pressed ) {
512 SEND_STRING("[]"SS_TAP(X_LEFT));
517 if( record->event.pressed ) {
518 SEND_STRING("{}"SS_TAP(X_LEFT));
523 if( record->event.pressed ) {
524 SEND_STRING("\'\'"SS_TAP(X_LEFT));
529 if( record->event.pressed ) {
530 SEND_STRING("\"\""SS_TAP(X_LEFT));
535 if( record->event.pressed ) {
536 SEND_STRING("``"SS_TAP(X_LEFT));
542 return process_record_keymap(keycode, record);
545 /*----------------------*\
546 |*-----LAYER CHANGE-----*|
547 \*----------------------*/
549 uint32_t layer_state_set_user(uint32_t state) {
551 state = layer_state_set_keymap (state);
552 #ifdef RGBLIGHT_ENABLE
553 // Change RGB lighting depending on the last layer activated
554 rgblight_change( biton32(state) );