diff options
Diffstat (limited to 'users/arkag/arkag.c')
-rw-r--r-- | users/arkag/arkag.c | 144 |
1 files changed, 84 insertions, 60 deletions
diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c index 97f84d8f0..564c234c3 100644 --- a/users/arkag/arkag.c +++ b/users/arkag/arkag.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include "arkag.h" | 1 | #include "arkag.h" |
2 | #include "eeprom.h" | ||
2 | 3 | ||
3 | /* | 4 | /* |
4 | Current Layout and Keeb: | 5 | Current Layout and Keeb: |
@@ -40,6 +41,7 @@ uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue) { | |||
40 | } | 41 | } |
41 | // End: Written by Chris Lewis | 42 | // End: Written by Chris Lewis |
42 | 43 | ||
44 | static int shift_int = 0; | ||
43 | uint8_t current_os, | 45 | uint8_t current_os, |
44 | mod_primary_mask, | 46 | mod_primary_mask, |
45 | fade_interval, | 47 | fade_interval, |
@@ -54,6 +56,8 @@ activityState state = boot; | |||
54 | bool aesthetic = false, | 56 | bool aesthetic = false, |
55 | shifty = false; | 57 | shifty = false; |
56 | 58 | ||
59 | float song_ussr[][2] = SONG(USSR_ANTHEM); | ||
60 | |||
57 | void set_color (Color new, bool update) { | 61 | void set_color (Color new, bool update) { |
58 | rgblight_sethsv_eeprom_helper(new.h, new.s, new.v, update); | 62 | rgblight_sethsv_eeprom_helper(new.h, new.s, new.v, update); |
59 | } | 63 | } |
@@ -188,21 +192,17 @@ void set_os (uint8_t os, bool update) { | |||
188 | case OS_MAC: | 192 | case OS_MAC: |
189 | set_unicode_input_mode(UC_OSX); | 193 | set_unicode_input_mode(UC_OSX); |
190 | underglow = (Color){ 213, 255, 255 }; | 194 | underglow = (Color){ 213, 255, 255 }; |
191 | mod_primary_mask = MOD_GUI_MASK; | ||
192 | break; | 195 | break; |
193 | case OS_WIN: | 196 | case OS_WIN: |
194 | set_unicode_input_mode(UC_WINC); | 197 | set_unicode_input_mode(UC_WINC); |
195 | underglow = (Color){ 128, 255, 255 }; | 198 | underglow = (Color){ 128, 255, 255 }; |
196 | mod_primary_mask = MOD_CTL_MASK; | ||
197 | break; | 199 | break; |
198 | case OS_NIX: | 200 | case OS_NIX: |
199 | set_unicode_input_mode(UC_LNX); | 201 | set_unicode_input_mode(UC_LNX); |
200 | underglow = (Color){ 43, 255, 255 }; | 202 | underglow = (Color){ 43, 255, 255 }; |
201 | mod_primary_mask = MOD_CTL_MASK; | ||
202 | break; | 203 | break; |
203 | default: | 204 | default: |
204 | underglow = (Color){ 0, 0, 255 }; | 205 | underglow = (Color){ 0, 0, 255 }; |
205 | mod_primary_mask = MOD_CTL_MASK; | ||
206 | } | 206 | } |
207 | set_color(underglow, update); | 207 | set_color(underglow, update); |
208 | flash_color = underglow; | 208 | flash_color = underglow; |
@@ -245,6 +245,17 @@ void sec_mod(bool press) { | |||
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | // register Meh if Win or Hyper if other | ||
249 | // KC_MEH/HYPR registers both sides, causes issues with some apps | ||
250 | // I'll do it myself, then | ||
251 | void meh_hyper(bool press) { | ||
252 | if (current_os == OS_WIN) { | ||
253 | (press) ? register_mods(L_BIT_MEH) : unregister_mods(L_BIT_MEH); | ||
254 | } else { | ||
255 | (press) ? register_mods(L_BIT_HYPR) : unregister_mods(L_BIT_HYPR); | ||
256 | } | ||
257 | } | ||
258 | |||
248 | void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { | 259 | void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { |
249 | if (use_shift) { | 260 | if (use_shift) { |
250 | register_code(KC_LSFT); | 261 | register_code(KC_LSFT); |
@@ -257,21 +268,25 @@ void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { | |||
257 | } | 268 | } |
258 | } | 269 | } |
259 | 270 | ||
260 | void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { | 271 | void pair_surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { |
261 | if (use_shift) { | ||
262 | register_code(KC_LSFT); | ||
263 | } | ||
264 | for (int i = 0; i < num_of_chars; i++) { | 272 | for (int i = 0; i < num_of_chars; i++) { |
273 | (use_shift) ? register_mods(MOD_BIT( KC_LSFT)) : NULL; | ||
265 | tap_code(keycode); | 274 | tap_code(keycode); |
266 | } | 275 | tap_code((keycode == KC_LCBR) ? KC_RCBR : (keycode == KC_LBRC) ? KC_RBRC : (keycode == KC_LPRN) ? KC_RPRN : KC_NO); |
267 | if (use_shift) { | 276 | (use_shift) ? unregister_mods(MOD_BIT( KC_LSFT)) : NULL; |
268 | unregister_code(KC_LSFT); | ||
269 | } | ||
270 | for (int i = 0; i < (num_of_chars/2); i++) { | ||
271 | tap_code(KC_LEFT); | 277 | tap_code(KC_LEFT); |
272 | } | 278 | } |
273 | } | 279 | } |
274 | 280 | ||
281 | void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { | ||
282 | for (int i = 0; i < num_of_chars; i++) { | ||
283 | (use_shift) ? register_mods(MOD_BIT( KC_LSFT)) : NULL; | ||
284 | tap_code(keycode); | ||
285 | (use_shift) ? unregister_mods(MOD_BIT( KC_LSFT)) : NULL; | ||
286 | } | ||
287 | multi_tap(num_of_chars / 2, KC_LEFT, false); | ||
288 | } | ||
289 | |||
275 | void long_keystroke(size_t num_of_keys, uint16_t keys[]) { | 290 | void long_keystroke(size_t num_of_keys, uint16_t keys[]) { |
276 | for (int i = 0; i < num_of_keys-1; i++) { | 291 | for (int i = 0; i < num_of_keys-1; i++) { |
277 | register_code(keys[i]); | 292 | register_code(keys[i]); |
@@ -282,6 +297,12 @@ void long_keystroke(size_t num_of_keys, uint16_t keys[]) { | |||
282 | } | 297 | } |
283 | } | 298 | } |
284 | 299 | ||
300 | void pri_mod_keystroke(uint16_t key) { | ||
301 | pri_mod(true); | ||
302 | tap_code(key); | ||
303 | pri_mod(false); | ||
304 | } | ||
305 | |||
285 | void matrix_init_user(void) { | 306 | void matrix_init_user(void) { |
286 | current_os = eeprom_read_byte(EECONFIG_USERSPACE); | 307 | current_os = eeprom_read_byte(EECONFIG_USERSPACE); |
287 | set_os(current_os, false); | 308 | set_os(current_os, false); |
@@ -326,27 +347,14 @@ void matrix_scan_user(void) { | |||
326 | } else { | 347 | } else { |
327 | } | 348 | } |
328 | } | 349 | } |
329 | SEQ_THREE_KEYS(KC_C, KC_S, KC_E) { | ||
330 | if (current_os == OS_WIN) { | ||
331 | long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LSFT, KC_ESC}); | ||
332 | } else { | ||
333 | } | ||
334 | } | ||
335 | SEQ_FOUR_KEYS(KC_C, KC_A, KC_L, KC_C) { | ||
336 | if (current_os == OS_WIN) { | ||
337 | SEND_STRING(SS_TAP(X_CALCULATOR)); | ||
338 | } else if (current_os == OS_MAC) { | ||
339 | SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI) "calculator" SS_TAP(X_ENTER)); | ||
340 | } | ||
341 | } | ||
342 | // end OS functions | 350 | // end OS functions |
343 | 351 | ||
344 | // begin format functions | 352 | // begin format functions |
345 | SEQ_ONE_KEY(KC_B) { | 353 | SEQ_ONE_KEY(KC_B) { |
346 | surround_type(4, KC_8, true); | 354 | surround_type(2, KC_8, true); |
347 | } | 355 | } |
348 | SEQ_ONE_KEY(KC_I) { | 356 | SEQ_ONE_KEY(KC_I) { |
349 | surround_type(2, KC_8, true); | 357 | surround_type(2, KC_MINS, true); |
350 | } | 358 | } |
351 | SEQ_ONE_KEY(KC_U) { | 359 | SEQ_ONE_KEY(KC_U) { |
352 | surround_type(4, KC_MINS, true); | 360 | surround_type(4, KC_MINS, true); |
@@ -357,6 +365,18 @@ void matrix_scan_user(void) { | |||
357 | SEQ_ONE_KEY(KC_C) { | 365 | SEQ_ONE_KEY(KC_C) { |
358 | send_unicode_hex_string("00E7"); | 366 | send_unicode_hex_string("00E7"); |
359 | } | 367 | } |
368 | SEQ_TWO_KEYS(KC_A, KC_V) { | ||
369 | surround_type(2, KC_QUOT, true); | ||
370 | pair_surround_type(2, KC_LCBR, true); | ||
371 | surround_type(2, KC_SPC, false); | ||
372 | } | ||
373 | SEQ_TWO_KEYS(KC_M, KC_L) { | ||
374 | pair_surround_type(1, KC_LBRC, false); | ||
375 | SEND_STRING("LINK_NAME"); | ||
376 | tap_code(KC_RGHT); | ||
377 | pair_surround_type(1, KC_LPRN, true); | ||
378 | pri_mod_keystroke(KC_V); | ||
379 | } | ||
360 | SEQ_TWO_KEYS(KC_C, KC_C) { | 380 | SEQ_TWO_KEYS(KC_C, KC_C) { |
361 | surround_type(2, KC_GRAVE, false); | 381 | surround_type(2, KC_GRAVE, false); |
362 | } | 382 | } |
@@ -369,28 +389,18 @@ void matrix_scan_user(void) { | |||
369 | SEQ_TWO_KEYS(KC_E, KC_E) { | 389 | SEQ_TWO_KEYS(KC_E, KC_E) { |
370 | send_unicode_hex_string("00E9"); | 390 | send_unicode_hex_string("00E9"); |
371 | } | 391 | } |
372 | SEQ_TWO_KEYS(KC_T, KC_I) { | ||
373 | surround_type(4, KC_MINS, true); | ||
374 | } | ||
375 | SEQ_TWO_KEYS(KC_T, KC_B) { | ||
376 | surround_type(4, KC_8, true); | ||
377 | } | ||
378 | // end format functions | 392 | // end format functions |
379 | 393 | ||
380 | // start fancy functions | 394 | // start fancy functions |
381 | SEQ_THREE_KEYS(KC_C, KC_C, KC_ENT) { | 395 | SEQ_THREE_KEYS(KC_C, KC_C, KC_ENT) { |
382 | surround_type(6, KC_GRAVE, false); | 396 | surround_type(6, KC_GRAVE, false); |
383 | pri_mod(true); | 397 | pri_mod_keystroke(KC_V); |
384 | tap_code(KC_V); | ||
385 | pri_mod(false); | ||
386 | multi_tap(3, KC_RGHT, false); | 398 | multi_tap(3, KC_RGHT, false); |
387 | tap_code(KC_ENTER); | 399 | tap_code(KC_ENTER); |
388 | } | 400 | } |
389 | SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) { | 401 | SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) { |
390 | multi_tap(3, KC_GRAVE, false); | 402 | multi_tap(3, KC_GRAVE, false); |
391 | pri_mod(true); | 403 | pri_mod_keystroke(KC_V); |
392 | tap_code(KC_V); | ||
393 | pri_mod(false); | ||
394 | multi_tap(2, KC_ENTER, false); | 404 | multi_tap(2, KC_ENTER, false); |
395 | } | 405 | } |
396 | // end fancy functions | 406 | // end fancy functions |
@@ -406,9 +416,7 @@ void matrix_scan_user(void) { | |||
406 | SEQ_THREE_KEYS(KC_D, KC_D, KC_D) { | 416 | SEQ_THREE_KEYS(KC_D, KC_D, KC_D) { |
407 | SEND_STRING(".\\Administrator"); | 417 | SEND_STRING(".\\Administrator"); |
408 | tap_code(KC_TAB); | 418 | tap_code(KC_TAB); |
409 | pri_mod(true); | 419 | pri_mod_keystroke(KC_V); |
410 | tap_code(KC_V); | ||
411 | pri_mod(false); | ||
412 | tap_code(KC_ENTER); | 420 | tap_code(KC_ENTER); |
413 | } | 421 | } |
414 | SEQ_THREE_KEYS(KC_L, KC_O, KC_D) { | 422 | SEQ_THREE_KEYS(KC_L, KC_O, KC_D) { |
@@ -426,7 +434,7 @@ void matrix_scan_user(void) { | |||
426 | // ┬─┬ノ( º _ º ノ) | 434 | // ┬─┬ノ( º _ º ノ) |
427 | send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 0020 30CE 0029"); | 435 | send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 0020 30CE 0029"); |
428 | } | 436 | } |
429 | SEQ_THREE_KEYS(KC_L, KC_E, KC_N) { | 437 | SEQ_THREE_KEYS(KC_L, KC_O, KC_L) { |
430 | // ( ͡° ͜ʖ ͡°) | 438 | // ( ͡° ͜ʖ ͡°) |
431 | send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029"); | 439 | send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029"); |
432 | } | 440 | } |
@@ -469,18 +477,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
469 | switch (keycode) { | 477 | switch (keycode) { |
470 | case KC_A ... KC_Z: | 478 | case KC_A ... KC_Z: |
471 | if (record->event.pressed) { | 479 | if (record->event.pressed) { |
472 | static int shift_int = 1; | 480 | shift_int += (rand() % 5); |
473 | int shift = shift_int % 2; | 481 | int shift = ((shift_int % 2) == 1) ? true : false; |
474 | shift_int++; | ||
475 | state = active; | 482 | state = active; |
476 | velocikey_accelerate(); | 483 | velocikey_accelerate(); |
477 | if (shift == 1){ | 484 | (shift) ? register_code(KC_LSFT) : NULL; |
478 | register_code(KC_LSFT); | ||
479 | } | ||
480 | tap_code(keycode); | 485 | tap_code(keycode); |
481 | if (shift == 1){ | 486 | (shift) ? unregister_code(KC_LSFT) : NULL; |
482 | unregister_code(KC_LSFT); | ||
483 | } | ||
484 | } | 487 | } |
485 | return false; | 488 | return false; |
486 | case KC_SPC: | 489 | case KC_SPC: |
@@ -496,13 +499,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
496 | } | 499 | } |
497 | 500 | ||
498 | switch (keycode) { | 501 | switch (keycode) { |
499 | case M_PMOD: | 502 | #ifdef AUDIO_ENABLE |
500 | pri_mod(record->event.pressed); | 503 | case M_USSR: |
501 | return false; | 504 | PLAY_SONG(song_ussr); |
502 | 505 | return false; | |
503 | case M_SMOD: | 506 | #endif |
504 | sec_mod(record->event.pressed); | ||
505 | return false; | ||
506 | 507 | ||
507 | case M_OS: | 508 | case M_OS: |
508 | if (record->event.pressed){ | 509 | if (record->event.pressed){ |
@@ -515,6 +516,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
515 | send_unicode_hex_string("2014"); | 516 | send_unicode_hex_string("2014"); |
516 | } | 517 | } |
517 | return false; | 518 | return false; |
519 | case M_LMHYP: | ||
520 | case M_EHYPR: | ||
521 | (keycode = M_LMHYP) ? (record->event.pressed) ? layer_on(_ARROW) : layer_off(_ARROW) : NULL; | ||
522 | meh_hyper(record->event.pressed); | ||
523 | return false; | ||
524 | |||
525 | case M_SFTY: | ||
526 | if(record->event.pressed){ | ||
527 | num_extra_flashes_off = (shifty) ? 1 : 0; | ||
528 | shifty = !shifty; | ||
529 | flash_color = underglow; | ||
530 | flash_state = flash_off; | ||
531 | return false; | ||
532 | } | ||
533 | |||
534 | case M_AEST: | ||
535 | if(record->event.pressed){ | ||
536 | num_extra_flashes_off = (aesthetic) ? 1 : 0; | ||
537 | aesthetic = !aesthetic; | ||
538 | flash_color = underglow; | ||
539 | flash_state = flash_off; | ||
540 | return false; | ||
541 | } | ||
518 | 542 | ||
519 | default: | 543 | default: |
520 | if (record->event.pressed) { | 544 | if (record->event.pressed) { |