diff options
| author | Alexander Kagno <cwre@protonmail.com> | 2018-09-29 18:51:06 -0600 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-09-29 17:51:06 -0700 |
| commit | 3875d6f5815bf263cb3ee5d18b74c5ec8ab865f2 (patch) | |
| tree | c5d1be0a02fa3374faeafd362f930bb1f48740f6 /users/arkag | |
| parent | 170507896d4d7fe12e1fa2c31ab8589e4cbdf7ba (diff) | |
| download | qmk_firmware-3875d6f5815bf263cb3ee5d18b74c5ec8ab865f2.tar.gz qmk_firmware-3875d6f5815bf263cb3ee5d18b74c5ec8ab865f2.zip | |
Keymap: Added Leader Key Functionality (#4025)
* deleting arkag branch, forcibly moving changes over to master
* fade_color function added, not tested
* added half functions some stuff
* surround_type function implemented and working.
* added flashing function and removed fading, flashing supports infinite flashing along with controlled number flashes
* added a fade state machine and functionality
* build optimizations, changed fade to bounce between bounds rather than roll over, added a HALMAK layout
* changes to sleep breath function, changed how I will switch to HALMAK
* support for halmak added
* support for activity detection added, condensed fading and flashing state machines, removed support for HALMAK and COLEMAK because arkag is stupid
* changed sleep and inactive behaviors, now the color shifting reverses on state change, yay! save_color and reset_color are made to enable layer color changing to look cooler.
* reformatted some if statements in state detection
* changes to force fade to pause on boot, or plug in.
* Attempting to move over to userspace, pushing to repository for help
* userspace stuff....
* userspace stuff....
* layout changes, working userspace,
Removed left side shift and replaced it with a MT() for LSFT and SPC. Userspace seems to be working properly now! HURRAY
* Layout change
Removed space/shift and reset modifiers to what they were originally. Added homerow modifiers.
* Removed excessive tabs in files
* Moved mods on homerow around...
* changes recommended by @drashna
* removed homerow mods, more flashy lighting!
* changed delays for lighting.
* velocikey code retro fit into userspace to match typing speed
currently "working" but isn't as reactive as I want.
* Readme and other documentation hidden throughout code
* Added a pretty picture
* pretty picture actually added
* More readme updates
* Velocikey now working inside my userspace!
* Changed repo macro and fixed readme
* Removed media layer, moved media control to LAZY layer
* fixed more merge issues when I had to merge...
* implemented some leader key stuff
* removed merge garbage...
* changes requested by @drashna, leader key switch from macros
Diffstat (limited to 'users/arkag')
| -rw-r--r-- | users/arkag/arkag.c | 213 | ||||
| -rw-r--r-- | users/arkag/config.h | 5 |
2 files changed, 84 insertions, 134 deletions
diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c index a35e13ed6..212d06de6 100644 --- a/users/arkag/arkag.c +++ b/users/arkag/arkag.c | |||
| @@ -370,115 +370,70 @@ void matrix_init_user(void) { | |||
| 370 | set_os(current_os, false); | 370 | set_os(current_os, false); |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | LEADER_EXTERNS(); | ||
| 374 | |||
| 373 | void matrix_scan_user(void) { | 375 | void matrix_scan_user(void) { |
| 374 | check_state(); | 376 | check_state(); |
| 375 | flash_rgb(); | 377 | flash_rgb(); |
| 376 | fade_rgb(); | 378 | fade_rgb(); |
| 377 | } | 379 | LEADER_DICTIONARY() { |
| 378 | 380 | leading = false; | |
| 379 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 381 | leader_end(); |
| 380 | switch (keycode) { | ||
| 381 | case M_PMOD: | ||
| 382 | if (record->event.pressed) { | ||
| 383 | pri_mod(true); | ||
| 384 | } else { | ||
| 385 | pri_mod(false); | ||
| 386 | } | ||
| 387 | return false; | ||
| 388 | 382 | ||
| 389 | case M_SMOD: | 383 | // begin OS functions |
| 390 | if (record->event.pressed) { | 384 | SEQ_TWO_KEYS(KC_P, KC_B) { |
| 391 | sec_mod(true); | ||
| 392 | } else { | ||
| 393 | sec_mod(false); | ||
| 394 | } | ||
| 395 | return false; | ||
| 396 | |||
| 397 | case M_P_B: | ||
| 398 | if (record->event.pressed) { | ||
| 399 | if (current_os == OS_WIN) { | 385 | if (current_os == OS_WIN) { |
| 400 | SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_PAUSE) SS_UP(X_LGUI)); | 386 | SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_PAUSE) SS_UP(X_LGUI)); |
| 401 | } else { | 387 | } else { |
| 402 | } | 388 | } |
| 403 | } | 389 | } |
| 404 | return false; | 390 | SEQ_THREE_KEYS(KC_C, KC_A, KC_D) { |
| 405 | |||
| 406 | case M_C_A_D: | ||
| 407 | if (record->event.pressed) { | ||
| 408 | if (current_os == OS_WIN) { | 391 | if (current_os == OS_WIN) { |
| 409 | SEND_STRING(SS_DOWN(X_LCTRL) SS_DOWN(X_LALT) SS_TAP(X_DELETE) SS_UP(X_LALT) SS_UP(X_LCTRL)); | 392 | SEND_STRING(SS_DOWN(X_LCTRL) SS_DOWN(X_LALT) SS_TAP(X_DELETE) SS_UP(X_LALT) SS_UP(X_LCTRL)); |
| 410 | } else { | 393 | } else { |
| 411 | } | 394 | } |
| 412 | } | 395 | } |
| 413 | return false; | 396 | SEQ_FOUR_KEYS(KC_C, KC_A, KC_L, KC_C) { |
| 414 | |||
| 415 | case M_CALC: | ||
| 416 | if (record->event.pressed) { | ||
| 417 | if (current_os == OS_WIN) { | 397 | if (current_os == OS_WIN) { |
| 418 | SEND_STRING(SS_TAP(X_CALCULATOR)); | 398 | SEND_STRING(SS_TAP(X_CALCULATOR)); |
| 419 | } else if (current_os == OS_MAC) { | 399 | } else if (current_os == OS_MAC) { |
| 420 | SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI) "calculator" SS_TAP(X_ENTER)); | 400 | SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI) "calculator" SS_TAP(X_ENTER)); |
| 421 | } | 401 | } |
| 422 | } | 402 | } |
| 423 | return false; | 403 | // end OS functions |
| 424 | |||
| 425 | case M_OS: | ||
| 426 | if (record->event.pressed) { | ||
| 427 | set_os((current_os+1) % _OS_COUNT, true); | ||
| 428 | } | ||
| 429 | return false; | ||
| 430 | |||
| 431 | case M_LOD: | ||
| 432 | if (record->event.pressed) { | ||
| 433 | send_unicode_hex_string("0CA0 005F 005F 0CA0"); | ||
| 434 | } | ||
| 435 | return false; | ||
| 436 | 404 | ||
| 437 | case M_LENNY: | 405 | // begin format functions |
| 438 | if (record->event.pressed) { | 406 | SEQ_ONE_KEY(KC_B) { |
| 439 | send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029"); | 407 | surround_type(4, KC_8, true); |
| 440 | } | 408 | } |
| 441 | return false; | 409 | SEQ_ONE_KEY(KC_I) { |
| 442 | 410 | surround_type(2, KC_8, true); | |
| 443 | |||
| 444 | case M_TF: | ||
| 445 | if (record->event.pressed) { | ||
| 446 | send_unicode_hex_string("0028 256F 2035 0414 2032 0029 256F 5F61 253B 2501 253B"); | ||
| 447 | } | 411 | } |
| 448 | return false; | 412 | SEQ_ONE_KEY(KC_U) { |
| 449 | 413 | surround_type(4, KC_MINS, true); | |
| 450 | case M_UF: | ||
| 451 | if (record->event.pressed) { | ||
| 452 | send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 0020 30CE 0029"); | ||
| 453 | } | 414 | } |
| 454 | return false; | 415 | SEQ_ONE_KEY(KC_S) { |
| 455 | 416 | surround_type(4, KC_GRAVE, true); | |
| 456 | case M_SHRUG: | ||
| 457 | if (record->event.pressed) { | ||
| 458 | send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); | ||
| 459 | } | 417 | } |
| 460 | return false; | 418 | SEQ_TWO_KEYS(KC_S, KC_S) { |
| 461 | 419 | if (current_os == OS_MAC) { | |
| 462 | case M_TM: | 420 | long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4}); |
| 463 | if (record->event.pressed) { | 421 | } else if (current_os == OS_WIN) { |
| 464 | send_unicode_hex_string("2122"); | 422 | long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S}); |
| 423 | } else { | ||
| 424 | return; | ||
| 425 | } | ||
| 465 | } | 426 | } |
| 466 | return false; | 427 | SEQ_ONE_KEY(KC_C) { |
| 467 | 428 | surround_type(2, KC_GRAVE, false); | |
| 468 | case M_REPO: | ||
| 469 | if (record->event.pressed) { | ||
| 470 | SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag"); | ||
| 471 | } | 429 | } |
| 472 | return false; | 430 | SEQ_TWO_KEYS(KC_C, KC_C) { |
| 473 | 431 | surround_type(6, KC_GRAVE, false); | |
| 474 | case M_GGT: | ||
| 475 | if (record->event.pressed) { | ||
| 476 | SEND_STRING("@GrahamGoldenTech.com"); | ||
| 477 | } | 432 | } |
| 478 | return false; | 433 | // end format functions |
| 479 | 434 | ||
| 480 | case M_SNIPT: | 435 | // start fancy functions |
| 481 | if (record->event.pressed) { | 436 | SEQ_THREE_KEYS(KC_C, KC_C, KC_C) { |
| 482 | surround_type(6, KC_GRAVE, false); | 437 | surround_type(6, KC_GRAVE, false); |
| 483 | pri_mod(true); | 438 | pri_mod(true); |
| 484 | tap_key(KC_V); | 439 | tap_key(KC_V); |
| @@ -488,44 +443,68 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 488 | tap_key(KC_RGHT); | 443 | tap_key(KC_RGHT); |
| 489 | tap_key(KC_ENTER); | 444 | tap_key(KC_ENTER); |
| 490 | } | 445 | } |
| 491 | return false; | 446 | // end fancy functions |
| 492 | 447 | ||
| 493 | case M_BOLD: | 448 | // start typing functions |
| 494 | if (record->event.pressed) { | 449 | SEQ_TWO_KEYS(KC_T, KC_M) { |
| 495 | surround_type(4, KC_8, true); | 450 | // ™ |
| 451 | send_unicode_hex_string("2122"); | ||
| 496 | } | 452 | } |
| 497 | return false; | 453 | SEQ_THREE_KEYS(KC_G, KC_G, KC_T) { |
| 454 | SEND_STRING("@GrahamGoldenTech.com"); | ||
| 455 | } | ||
| 456 | SEQ_THREE_KEYS(KC_L, KC_O, KC_D) { | ||
| 457 | // ಠ__ಠ | ||
| 458 | send_unicode_hex_string("0CA0 005F 005F 0CA0"); | ||
| 459 | } | ||
| 460 | SEQ_FOUR_KEYS(KC_R, KC_E, KC_P, KC_O) { | ||
| 461 | SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag"); | ||
| 462 | } | ||
| 463 | SEQ_FOUR_KEYS(KC_F, KC_L, KC_I, KC_P) { | ||
| 464 | // (╯‵Д′)╯彡┻━┻ | ||
| 465 | send_unicode_hex_string("0028 256F 2035 0414 2032 0029 256F 5F61 253B 2501 253B"); | ||
| 466 | } | ||
| 467 | SEQ_FIVE_KEYS(KC_U, KC_F, KC_L, KC_I, KC_P) { | ||
| 468 | // ┬─┬ノ( º _ º ノ) | ||
| 469 | send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 0020 30CE 0029"); | ||
| 470 | } | ||
| 471 | SEQ_FIVE_KEYS(KC_L, KC_E, KC_N, KC_N, KC_Y) { | ||
| 472 | // ( ͡° ͜ʖ ͡°) | ||
| 473 | send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029"); | ||
| 474 | } | ||
| 475 | SEQ_FIVE_KEYS(KC_S, KC_H, KC_R, KC_U, KC_G) { | ||
| 476 | // ¯\_(ツ)_/¯ | ||
| 477 | send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); | ||
| 478 | } | ||
| 479 | // end typing functions | ||
| 498 | 480 | ||
| 499 | case M_ITAL: | 481 | } |
| 482 | } | ||
| 483 | |||
| 484 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 485 | switch (keycode) { | ||
| 486 | case M_PMOD: | ||
| 500 | if (record->event.pressed) { | 487 | if (record->event.pressed) { |
| 501 | surround_type(2, KC_8, true); | 488 | pri_mod(true); |
| 489 | } else { | ||
| 490 | pri_mod(false); | ||
| 502 | } | 491 | } |
| 503 | return false; | 492 | return false; |
| 504 | 493 | ||
| 505 | case M_ULIN: | 494 | case M_SMOD: |
| 506 | if (record->event.pressed) { | 495 | if (record->event.pressed) { |
| 507 | surround_type(4, KC_MINS, true); | 496 | sec_mod(true); |
| 497 | } else { | ||
| 498 | sec_mod(false); | ||
| 508 | } | 499 | } |
| 509 | return false; | 500 | return false; |
| 510 | 501 | ||
| 511 | case KC_LSFT: | 502 | case M_OS: |
| 512 | if (record->event.pressed) { | 503 | if (record->event.pressed) { |
| 513 | save_color(underglow); | 504 | set_os((current_os+1) % _OS_COUNT, true); |
| 514 | underglow = mod_color(underglow, true, 75); | ||
| 515 | SEND_STRING(SS_DOWN(X_LSHIFT)); | ||
| 516 | } else { | ||
| 517 | reset_color(); | ||
| 518 | SEND_STRING(SS_UP(X_LSHIFT)); | ||
| 519 | } | 505 | } |
| 520 | return false; | 506 | return false; |
| 521 | 507 | ||
| 522 | case MEDIA: | ||
| 523 | case LAZY: | ||
| 524 | case KEEB: | ||
| 525 | case RAISE: | ||
| 526 | case LOWER: | ||
| 527 | return true; | ||
| 528 | |||
| 529 | default: | 508 | default: |
| 530 | if (record->event.pressed) { | 509 | if (record->event.pressed) { |
| 531 | state = active; | 510 | state = active; |
| @@ -535,36 +514,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 535 | } | 514 | } |
| 536 | } | 515 | } |
| 537 | 516 | ||
| 538 | uint32_t layer_state_set_user(uint32_t state) { | ||
| 539 | switch (biton32(state)) { | ||
| 540 | case _LAZY: | ||
| 541 | save_color(underglow); | ||
| 542 | underglow = mod_color(underglow, true, 50); | ||
| 543 | break; | ||
| 544 | case _MEDIA: | ||
| 545 | save_color(underglow); | ||
| 546 | underglow = mod_color(underglow, true, 150); | ||
| 547 | break; | ||
| 548 | case _KEEB: | ||
| 549 | save_color(underglow); | ||
| 550 | underglow = mod_color(underglow, false, 150); | ||
| 551 | break; | ||
| 552 | case _LOWER: | ||
| 553 | save_color(underglow); | ||
| 554 | underglow = mod_color(underglow, false, 100); | ||
| 555 | break; | ||
| 556 | case _RAISE: | ||
| 557 | save_color(underglow); | ||
| 558 | underglow = mod_color(underglow, true, 100); | ||
| 559 | break; | ||
| 560 | default: | ||
| 561 | reset_color(); | ||
| 562 | break; | ||
| 563 | } | ||
| 564 | set_color(underglow, false); | ||
| 565 | return state; | ||
| 566 | } | ||
| 567 | |||
| 568 | //Tap Dance Definitions | 517 | //Tap Dance Definitions |
| 569 | qk_tap_dance_action_t tap_dance_actions[] = { | 518 | qk_tap_dance_action_t tap_dance_actions[] = { |
| 570 | [TD_3_GRV_ACT] = ACTION_TAP_DANCE_FN (dance_3), | 519 | [TD_3_GRV_ACT] = ACTION_TAP_DANCE_FN (dance_3), |
diff --git a/users/arkag/config.h b/users/arkag/config.h index e715e5534..2e0a9ad01 100644 --- a/users/arkag/config.h +++ b/users/arkag/config.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | #define TAPPING_TERM 200 | 3 | #define TAPPING_TERM 200 |
| 4 | #define LEADER_TIMEOUT 250 | ||
| 4 | 5 | ||
| 5 | #define IGNORE_MOD_TAP_INTERRUPT | 6 | #define LEADER_PER_KEY_TIMING |
