diff options
| author | kuchosauronad0 <22005492+kuchosauronad0@users.noreply.github.com> | 2019-08-24 09:01:12 -0700 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-08-24 09:01:12 -0700 |
| commit | 2ef6bbbf5ffba0142613bc394c41ba580a7e2c7e (patch) | |
| tree | 84a21a557f13e08ef6cc660a05f2fb2edc011ddf /users | |
| parent | 51bcadf38cfccc08b287554ab17e21624abf55b8 (diff) | |
| download | qmk_firmware-2ef6bbbf5ffba0142613bc394c41ba580a7e2c7e.tar.gz qmk_firmware-2ef6bbbf5ffba0142613bc394c41ba580a7e2c7e.zip | |
[Keymap] Update to userspace kuchosauroand0 (#6596)
* added combos
* minor adjustments, added combos
* Add second encoder, add modifiers to encoders
Added a skeleton for the possibily having a second encoder.
Added 9 modifiers for the first rotary encoder:
- None
General navigation. Page up/down
- SHIFT
Fast navigation. Home/end
- CTRL
Vertical navigation. Up/down
- CTRL+SHIFT
Horizontal navigation. Left/right
- ALT
Audio volume control.
- GUI
Browser navigation(windows). Forward/backward
- ALT+SHIFT
Form navigation. Tab up/down
- ALT+CTRL
Media control. (Play|pause)/mute
- HYPER
Media navigation. Next/prev track
Key codes are stored in `uint16_t encoder_actions[2][9]`
* Add second encoder, add modifiers to encoders
Added a skeleton for the possibily having a second encoder.
Added 9 modifiers for the first rotary encoder:
- None
General navigation. Page up/down
- SHIFT
Fast navigation. Home/end
- CTRL
Vertical navigation. Up/down
- CTRL+SHIFT
Horizontal navigation. Left/right
- ALT
Audio volume control.
- GUI
Browser navigation(windows). Forward/backward
- ALT+SHIFT
Form navigation. Tab up/down
- ALT+CTRL
Media control. (Play|pause)/mute
- HYPER
Media navigation. Next/prev track
Key codes are stored in `uint16_t encoder_actions[2][9]`
* Clean up; added combos
Combos:
- CV: Copy
- XC: Cut
- ZV: Paste
- QP: KC_SLEEP
* Fix LEADER_DICTIONARY to be more useful
* Add documentation
* Minor fixes
* Raise TAPPING_TERM
* testing
* Rearrange modifiers
* Fix kc being stored in uint8 instead of uint16
* Update documentation
* Clean up
* Remove excess comments
* Put encoder_actions in progmem
Diffstat (limited to 'users')
| -rw-r--r-- | users/kuchosauronad0/combo.c | 27 | ||||
| -rw-r--r-- | users/kuchosauronad0/combo.h | 21 | ||||
| -rw-r--r-- | users/kuchosauronad0/config.h | 49 | ||||
| -rw-r--r-- | users/kuchosauronad0/encoder.c | 65 | ||||
| -rw-r--r-- | users/kuchosauronad0/encoder.h | 1 | ||||
| -rw-r--r-- | users/kuchosauronad0/leader.c | 43 | ||||
| -rw-r--r-- | users/kuchosauronad0/readme.md | 128 | ||||
| -rw-r--r-- | users/kuchosauronad0/rules.mk | 3 | ||||
| -rw-r--r-- | users/kuchosauronad0/tap_dances.c | 6 |
9 files changed, 254 insertions, 89 deletions
diff --git a/users/kuchosauronad0/combo.c b/users/kuchosauronad0/combo.c new file mode 100644 index 000000000..b4e8e84ae --- /dev/null +++ b/users/kuchosauronad0/combo.c | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #include "combo.h" | ||
| 2 | |||
| 3 | void process_combo_event(uint8_t combo_index, bool pressed){ | ||
| 4 | switch(combo_index) { | ||
| 5 | case ZV_COPY: | ||
| 6 | if (pressed) { | ||
| 7 | tap_code16(LCTL(KC_C)); | ||
| 8 | } | ||
| 9 | break; | ||
| 10 | case XV_CUT: | ||
| 11 | if (pressed) { | ||
| 12 | tap_code16(LCTL(KC_X)); | ||
| 13 | } | ||
| 14 | break; | ||
| 15 | |||
| 16 | case CV_PASTE: | ||
| 17 | if (pressed) { | ||
| 18 | tap_code16(LCTL(KC_V)); | ||
| 19 | } | ||
| 20 | break; | ||
| 21 | case QP_SLEEP: | ||
| 22 | if (pressed) { | ||
| 23 | tap_code16(KC_SYSTEM_SLEEP); | ||
| 24 | } | ||
| 25 | break; | ||
| 26 | } | ||
| 27 | } | ||
diff --git a/users/kuchosauronad0/combo.h b/users/kuchosauronad0/combo.h new file mode 100644 index 000000000..e2ff09ab5 --- /dev/null +++ b/users/kuchosauronad0/combo.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #pragma once | ||
| 2 | #include "quantum.h" | ||
| 3 | enum combo_events { | ||
| 4 | ZV_COPY, | ||
| 5 | XV_CUT, | ||
| 6 | CV_PASTE, | ||
| 7 | QP_SLEEP | ||
| 8 | }; | ||
| 9 | |||
| 10 | const uint16_t PROGMEM copy_combo[] = {KC_Z, KC_V, COMBO_END}; | ||
| 11 | const uint16_t PROGMEM cut_combo[] = {KC_X, KC_V, COMBO_END}; | ||
| 12 | const uint16_t PROGMEM paste_combo[] = {KC_C, KC_V, COMBO_END}; | ||
| 13 | const uint16_t PROGMEM sleep_combo[] = {KC_Q, KC_P, COMBO_END}; | ||
| 14 | |||
| 15 | combo_t key_combos[COMBO_COUNT] = { | ||
| 16 | [ZV_COPY] = COMBO_ACTION(copy_combo), | ||
| 17 | [XV_CUT] = COMBO_ACTION(cut_combo), | ||
| 18 | [CV_PASTE] = COMBO_ACTION(paste_combo), | ||
| 19 | [QP_SLEEP] = COMBO_ACTION(sleep_combo), | ||
| 20 | }; | ||
| 21 | |||
diff --git a/users/kuchosauronad0/config.h b/users/kuchosauronad0/config.h index f543a4fd2..b2c63c1e0 100644 --- a/users/kuchosauronad0/config.h +++ b/users/kuchosauronad0/config.h | |||
| @@ -1,16 +1,14 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | |||
| 4 | #ifdef AUDIO_ENABLE | 3 | #ifdef AUDIO_ENABLE |
| 5 | #define AUDIO_CLICKY | 4 | #define AUDIO_CLICKY |
| 6 | #define STARTUP_SONG SONG(RICK_ROLL) | 5 | #define STARTUP_SONG SONG(RICK_ROLL) |
| 7 | #define GOODBYE_SONG SONG(SONIC_RING) | 6 | #define GOODBYE_SONG SONG(SONIC_RING) |
| 8 | #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ | 7 | #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ |
| 9 | SONG(COLEMAK_SOUND), \ | 8 | SONG(COLEMAK_SOUND), \ |
| 10 | SONG(DVORAK_SOUND), \ | 9 | SONG(DVORAK_SOUND), \ |
| 11 | SONG(OVERWATCH_THEME) \ | 10 | SONG(OVERWATCH_THEME) \ |
| 12 | } | 11 | } |
| 13 | |||
| 14 | #define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f | 12 | #define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f |
| 15 | // #ifdef RGBLIGHT_ENABLE | 13 | // #ifdef RGBLIGHT_ENABLE |
| 16 | // #define NO_MUSIC_MODE | 14 | // #define NO_MUSIC_MODE |
| @@ -19,13 +17,11 @@ | |||
| 19 | // #undef NOTE_REST | 17 | // #undef NOTE_REST |
| 20 | // #define NOTE_REST 1.00f | 18 | // #define NOTE_REST 1.00f |
| 21 | // #endif // !__arm__ | 19 | // #endif // !__arm__ |
| 22 | 20 | #define UNICODE_SONG_OSX SONG(RICK_ROLL) | |
| 23 | #define UNICODE_SONG_OSX SONG(RICK_ROLL) | 21 | #define UNICODE_SONG_LNX SONG(RICK_ROLL) |
| 24 | #define UNICODE_SONG_LNX SONG(RICK_ROLL) | 22 | #define UNICODE_SONG_WIN SONG(RICK_ROLL) |
| 25 | #define UNICODE_SONG_WIN SONG(RICK_ROLL) | 23 | #define UNICODE_SONG_BSD SONG(RICK_ROLL) |
| 26 | #define UNICODE_SONG_BSD SONG(RICK_ROLL) | 24 | #define UNICODE_SONG_WINC SONG(RICK_ROLL) |
| 27 | #define UNICODE_SONG_WINC SONG(RICK_ROLL) | ||
| 28 | |||
| 29 | #endif // !AUDIO_ENABLE | 25 | #endif // !AUDIO_ENABLE |
| 30 | 26 | ||
| 31 | #ifdef RGBLIGHT_ENABLE | 27 | #ifdef RGBLIGHT_ENABLE |
| @@ -48,7 +44,19 @@ | |||
| 48 | #define QMK_KEYS_PER_SCAN 4 | 44 | #define QMK_KEYS_PER_SCAN 4 |
| 49 | #endif // !QMK_KEYS_PER_SCAN | 45 | #endif // !QMK_KEYS_PER_SCAN |
| 50 | 46 | ||
| 47 | #if defined(LEADER_ENABLE) | ||
| 48 | #define LEADER_PER_KEY_TIMING | ||
| 49 | #define LEADER_TIMEOUT 250 | ||
| 50 | #endif // !LEADER_ENABLE | ||
| 51 | |||
| 52 | #if defined(COMBO_ENABLE) | ||
| 53 | #define COMBO_COUNT 4 | ||
| 54 | #define COMBO_TERM 150 | ||
| 55 | #endif // !COMBO_ENABLE | ||
| 51 | 56 | ||
| 57 | #if defined(NKRO_ENABLE) | ||
| 58 | #define FORCE_NKRO | ||
| 59 | #endif // !NKRO_ENABLE | ||
| 52 | 60 | ||
| 53 | // this makes it possible to do rolling combos (zx) with keys that | 61 | // this makes it possible to do rolling combos (zx) with keys that |
| 54 | // convert to other keys on hold (z becomes ctrl when you hold it, | 62 | // convert to other keys on hold (z becomes ctrl when you hold it, |
| @@ -59,8 +67,6 @@ | |||
| 59 | //#define TAPPING_FORCE_HOLD | 67 | //#define TAPPING_FORCE_HOLD |
| 60 | //#define RETRO_TAPPING | 68 | //#define RETRO_TAPPING |
| 61 | 69 | ||
| 62 | #define FORCE_NKRO | ||
| 63 | |||
| 64 | #ifndef TAPPING_TOGGLE | 70 | #ifndef TAPPING_TOGGLE |
| 65 | #define TAPPING_TOGGLE 1 | 71 | #define TAPPING_TOGGLE 1 |
| 66 | #endif | 72 | #endif |
| @@ -68,26 +74,17 @@ | |||
| 68 | #ifdef TAPPING_TERM | 74 | #ifdef TAPPING_TERM |
| 69 | #undef TAPPING_TERM | 75 | #undef TAPPING_TERM |
| 70 | #endif // !TAPPING_TERM | 76 | #endif // !TAPPING_TERM |
| 71 | #if defined(KEYBOARD_ergodox_ez) | 77 | #if defined(KEYBOARD_handwired_kuchosauronad0_planckenstein) |
| 72 | #define TAPPING_TERM 185 | 78 | #define TAPPING_TERM 185 |
| 73 | #elif defined(KEYBOARD_crkbd) | 79 | #elif defined(KEYBOARD_c39) |
| 74 | #define TAPPING_TERM 200 | 80 | #define TAPPING_TERM 200 |
| 75 | #else | 81 | #else |
| 76 | #define TAPPING_TERM 150 | 82 | #define TAPPING_TERM 180 |
| 77 | #endif | 83 | #endif |
| 78 | 84 | ||
| 79 | 85 | ||
| 80 | // Disable action_get_macro and fn_actions, since we don't use these | ||
| 81 | // and it saves on space in the firmware. | ||
| 82 | #define NO_ACTION_MACRO | ||
| 83 | #define NO_ACTION_FUNCTION | ||
| 84 | |||
| 85 | #define TAP_CODE_DELAY 5 | 86 | #define TAP_CODE_DELAY 5 |
| 86 | 87 | ||
| 87 | // Enable Leader key | 88 | #define MACRO_TIMER 5 |
| 88 | #if defined(LEADER_ENABLE) | 89 | |
| 89 | #define LEADER_PER_KEY_TIMING | ||
| 90 | #define LEADER_TIMEOUT 250 | ||
| 91 | #endif // !LEADER_ENABLE | ||
| 92 | 90 | ||
| 93 | #define MACRO_TIMER 5 | ||
diff --git a/users/kuchosauronad0/encoder.c b/users/kuchosauronad0/encoder.c index 1b9b2cb12..06b7b5123 100644 --- a/users/kuchosauronad0/encoder.c +++ b/users/kuchosauronad0/encoder.c | |||
| @@ -1,10 +1,63 @@ | |||
| 1 | #include "encoder.h" | 1 | #include "encoder.h" |
| 2 | |||
| 3 | void encoder_update_user(uint8_t index, bool clockwise) { | 2 | void encoder_update_user(uint8_t index, bool clockwise) { |
| 4 | if (clockwise) { | 3 | static uint16_t kc; |
| 5 | tap_code(KC_1); | 4 | uint8_t temp_mod = get_mods(); |
| 6 | } else { | 5 | if (index == 0) { /* first encoder */ |
| 7 | tap_code(KC_0); | 6 | if (clockwise) { |
| 7 | //if (temp_mod & MOD_BIT(KC_HYPR)){ // TODO: not how this works, only registers CTRL | ||
| 8 | if ((temp_mod & MOD_MASK_CTRL) && (temp_mod & MOD_MASK_SHIFT) && (temp_mod & MOD_MASK_ALT) && (temp_mod & MOD_MASK_GUI)) { // HYPER | ||
| 9 | kc = encoder_actions[0][8]; | ||
| 10 | } else if ( (temp_mod & MOD_MASK_SHIFT) && (temp_mod & MOD_MASK_ALT) ) { // ALT+SHIFT | ||
| 11 | kc = encoder_actions[0][7]; | ||
| 12 | } else if ( (temp_mod & MOD_MASK_SHIFT) && (temp_mod & MOD_MASK_CTRL) ) { // CTRL+SHIFT | ||
| 13 | kc = encoder_actions[0][6]; | ||
| 14 | } else if ( (temp_mod & MOD_MASK_CTRL) && (temp_mod & MOD_MASK_ALT) ) { // CTRL+ALT | ||
| 15 | kc = encoder_actions[0][5]; | ||
| 16 | } else if (temp_mod & MOD_MASK_GUI) { // GUI | ||
| 17 | kc = encoder_actions[0][4]; | ||
| 18 | } else if (temp_mod & MOD_MASK_SHIFT) { // SHIFT | ||
| 19 | kc = encoder_actions[0][3]; | ||
| 20 | } else if (temp_mod & MOD_MASK_ALT) { // ALT | ||
| 21 | kc = encoder_actions[0][2]; | ||
| 22 | } else if (temp_mod & MOD_MASK_CTRL) { // CTRL | ||
| 23 | kc = encoder_actions[0][1]; | ||
| 24 | } else { // None | ||
| 25 | kc = encoder_actions[0][0]; | ||
| 26 | } | ||
| 27 | } else { // Counter Clockwise | ||
| 28 | if ((temp_mod & MOD_MASK_CTRL) && (temp_mod & MOD_MASK_SHIFT) && (temp_mod & MOD_MASK_ALT) && (temp_mod & MOD_MASK_GUI)) { // HYPER | ||
| 29 | kc = encoder_actions[1][8]; | ||
| 30 | } else if ( (temp_mod & MOD_MASK_SHIFT) && (temp_mod & MOD_MASK_ALT) ) { // ALT+SHIFT | ||
| 31 | kc = encoder_actions[1][7]; | ||
| 32 | } else if ( (temp_mod & MOD_MASK_SHIFT) && (temp_mod & MOD_MASK_CTRL) ) { // CTRL+SHIFT | ||
| 33 | kc = encoder_actions[1][6]; | ||
| 34 | } else if ( (temp_mod & MOD_MASK_CTRL) && (temp_mod & MOD_MASK_ALT) ) { // CTRL+ALT | ||
| 35 | kc = encoder_actions[1][5]; | ||
| 36 | } else if (temp_mod & MOD_MASK_GUI) { // GUI | ||
| 37 | kc = encoder_actions[1][4]; | ||
| 38 | } else if (temp_mod & MOD_MASK_SHIFT) { // SHIFT | ||
| 39 | kc = encoder_actions[1][3]; | ||
| 40 | } else if (temp_mod & MOD_MASK_ALT) { // ALT | ||
| 41 | kc = encoder_actions[1][2]; | ||
| 42 | } else if (temp_mod & MOD_MASK_CTRL) { // CTRL | ||
| 43 | kc = encoder_actions[1][1]; | ||
| 44 | } else { // None | ||
| 45 | kc = encoder_actions[1][0]; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | clear_mods(); | ||
| 49 | tap_code16(kc); | ||
| 50 | set_mods(temp_mod); | ||
| 51 | } else if (index == 1){ // second Encoder | ||
| 52 | if (clockwise) { | ||
| 53 | tap_code(KC_0); | ||
| 54 | } else{ | ||
| 55 | tap_code(KC_1); | ||
| 56 | } | ||
| 8 | } | 57 | } |
| 9 | } | 58 | } |
| 10 | 59 | const uint16_t PROGMEM encoder_actions[][9] = { \ | |
| 60 | // None CTRL ALT SHIFT GUI CTRL+ALT CTRL+SHFT ALT+SHFT HYPER | ||
| 61 | { KC_PGDN, KC_DOWN, KC_AUDIO_VOL_UP, KC_END, KC_WWW_FORWARD, KC_AUDIO_MUTE, KC_RIGHT, LSFT(KC_TAB), KC_MEDIA_NEXT_TRACK}, \ | ||
| 62 | { KC_PGUP, KC_UP, KC_AUDIO_VOL_DOWN, KC_HOME, KC_WWW_BACK, KC_MEDIA_PLAY_PAUSE, KC_LEFT, KC_TAB, KC_MEDIA_PREV_TRACK} | ||
| 63 | }; | ||
diff --git a/users/kuchosauronad0/encoder.h b/users/kuchosauronad0/encoder.h index 078989d52..2610c9677 100644 --- a/users/kuchosauronad0/encoder.h +++ b/users/kuchosauronad0/encoder.h | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | #include "quantum.h" | 2 | #include "quantum.h" |
| 3 | const uint16_t PROGMEM encoder_actions[][9]; | ||
| 3 | void encoder_update_user(uint8_t index, bool clockwise); | 4 | void encoder_update_user(uint8_t index, bool clockwise); |
diff --git a/users/kuchosauronad0/leader.c b/users/kuchosauronad0/leader.c index 611b70074..58935abb3 100644 --- a/users/kuchosauronad0/leader.c +++ b/users/kuchosauronad0/leader.c | |||
| @@ -20,12 +20,9 @@ void matrix_scan_user(void){ | |||
| 20 | LEADER_DICTIONARY() { | 20 | LEADER_DICTIONARY() { |
| 21 | leading = false; | 21 | leading = false; |
| 22 | leader_end(); | 22 | leader_end(); |
| 23 | // Q is for TMUX | ||
| 24 | // Z is for OS related things | ||
| 25 | // other single key sequences are mostly for terminals and vim | ||
| 26 | 23 | ||
| 27 | SEQ_ONE_KEY(KC_W) { | 24 | SEQ_ONE_KEY(KC_W) { |
| 28 | // Vim + Tmux Macro, when in command mode in vim: write to file, change to the other pane in the current session and repeat the last command | 25 | // vim/tmux: Use in command mode in vim: write to file, switch tmux pane in the current session window and repeat the last command |
| 29 | SEND_STRING(":w" SS_TAP(X_ENTER)); | 26 | SEND_STRING(":w" SS_TAP(X_ENTER)); |
| 30 | tmux_pane_switch_repeat(); | 27 | tmux_pane_switch_repeat(); |
| 31 | } | 28 | } |
| @@ -36,42 +33,38 @@ void matrix_scan_user(void){ | |||
| 36 | } | 33 | } |
| 37 | 34 | ||
| 38 | SEQ_ONE_KEY(KC_A) { | 35 | SEQ_ONE_KEY(KC_A) { |
| 39 | // Send the Tmux Prefix and press 'right' arrow | 36 | // tmux: Send the prefix and press 'right' arrow |
| 40 | tmux_prefix(); | 37 | tmux_prefix(); |
| 41 | tap_code(KC_RIGHT); | 38 | tap_code(KC_RIGHT); |
| 42 | } | 39 | } |
| 43 | 40 | ||
| 44 | SEQ_TWO_KEYS(KC_T, KC_T) { | 41 | SEQ_TWO_KEYS(KC_T, KC_T) { |
| 45 | // Send the Tmux Prefix to a nested session | 42 | // tmux: Send the prefix to a nested session |
| 46 | tmux_prefix(); | 43 | tmux_prefix(); |
| 47 | tmux_prefix(); | 44 | tmux_prefix(); |
| 48 | } | 45 | } |
| 49 | SEQ_TWO_KEYS(KC_Q, KC_A) { | 46 | SEQ_TWO_KEYS(KC_T, KC_R) { |
| 50 | // Switch pane and repeat last action | 47 | // tmux: Switch pane and repeat last action |
| 51 | tmux_pane_switch_repeat(); | 48 | tmux_pane_switch_repeat(); |
| 52 | } | 49 | } |
| 53 | 50 | ||
| 54 | SEQ_TWO_KEYS(KC_Z, KC_P){ | 51 | SEQ_TWO_KEYS(KC_V, KC_Z){ |
| 55 | // Press windows key, send string 'plex' and press enter | 52 | // vim: Zoom pane |
| 56 | register_code(KC_LGUI); | 53 | tap_code16(LCTL(KC_W)); |
| 57 | register_code(KC_S); | 54 | tap_code16(LSFT(KC_BSLS)); |
| 58 | unregister_code(KC_S); | ||
| 59 | |||
| 60 | unregister_code(KC_LGUI); | ||
| 61 | SEND_STRING("plex"); | ||
| 62 | tap_code(KC_ENTER); | ||
| 63 | } | 55 | } |
| 64 | 56 | ||
| 65 | SEQ_TWO_KEYS(KC_Z, KC_F) { | 57 | SEQ_TWO_KEYS(KC_V, KC_R) { |
| 66 | // Open a search | 58 | // vim: Substitute and place cursor |
| 67 | register_code(KC_LGUI); | 59 | SEND_STRING(":%s///g" SS_TAP(X_LEFT)); |
| 68 | register_code(KC_S); | 60 | tap_code(KC_LEFT); |
| 69 | unregister_code(KC_S); | 61 | tap_code(KC_LEFT); |
| 70 | unregister_code(KC_LGUI); | ||
| 71 | } | 62 | } |
| 72 | 63 | ||
| 73 | SEQ_TWO_KEYS(KC_Z, KC_Z) { | 64 | SEQ_TWO_KEYS(KC_V, KC_T) { |
| 74 | SEND_STRING("https://start.duckduckgo.com"SS_TAP(X_ENTER)); | 65 | // vim: move current pane to new tab |
| 66 | tap_code16(LCTL(KC_W)); | ||
| 67 | tap_code16(LSFT(KC_T)); | ||
| 75 | } | 68 | } |
| 76 | 69 | ||
| 77 | SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){ | 70 | SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){ |
diff --git a/users/kuchosauronad0/readme.md b/users/kuchosauronad0/readme.md index 8211dc189..b577eedb7 100644 --- a/users/kuchosauronad0/readme.md +++ b/users/kuchosauronad0/readme.md | |||
| @@ -1,10 +1,19 @@ | |||
| 1 | # qmk userspace for kuchosauronad0 | 1 | # Table of Contents |
| 2 | Thanks to drashna and everyone else in the qmk_firmware/users/ directory :) | 2 | 1. [Overview](#overview)[[documentation](https://docs.qmk.fm/#/feature_userspace)] |
| 3 | 3 | 2. [Keyboard Layout Templates](#keyboard-layout-templates) | |
| 4 | # Overview | 4 | 3. [Custom Keycodes](#custom-keycodes) [[documentation](https://docs.qmk.fm/#/feature_macros?id=the-new-way-send_string-amp-process_record_user)] |
| 5 | 5 | 4. [Tap Dances](#tap-dances) [[documentation](https://docs.qmk.fm/#/feature_tap_dance)] | |
| 6 | ## Keyboard Layout Templates | 6 | 5. [Encoders](#encoders) [[documentation](https://docs.qmk.fm/#/feature_encoders)] |
| 7 | This borrows from @jola5's "Not quite neo" code. This allows me to maintain blocks of keymaps in the userspace, so that I can modify the userspace, and this is reflected in all of the keyboards that use it, at once. | 7 | 6. [Leader Key](#leader-key) [[documentation](https://docs.qmk.fm/#/feature_leader_key)] |
| 8 | 7. [Unicode](#unicode) [[documentation](https://docs.qmk.fm/#/feature_unicode)] | ||
| 9 | 8. [Combo Keys](#combo-keys) [[documentation](https://docs.qmk.fm/#/feature_combo)] | ||
| 10 | 9. [Secret Macros](#secret-macros) [[documentation](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/readme_secrets.md)] | ||
| 11 | |||
| 12 | # [Overview](#overview) | ||
| 13 | Thanks to [drashna](https://github.com/drashna) and the people of the discord server and everyone else in the qmk_firmware/users/ directory :) | ||
| 14 | |||
| 15 | ## [Keyboard Layout Templates](#keyboard-layout-temple) | ||
| 16 | This borrows from [jola5](https://github.com/jola5)'s "Not quite neo" code. The code of the userspace is shared between all keyboards, so that one can maintain functionality of all keyboards at once by modifying a few files in a central location. | ||
| 8 | 17 | ||
| 9 | This makes adding tap/hold mods, or other special keycodes or functions to all keyboards super easy, as it's done to all of them at once. | 18 | This makes adding tap/hold mods, or other special keycodes or functions to all keyboards super easy, as it's done to all of them at once. |
| 10 | 19 | ||
| @@ -14,45 +23,107 @@ The caveat here is that the keymap needs a processor/wrapper, as it doesn't like | |||
| 14 | 23 | ||
| 15 | Once that's been done and you've switched the keymaps to use the "wrapper", it will read the substitution blocks just fine. | 24 | Once that's been done and you've switched the keymaps to use the "wrapper", it will read the substitution blocks just fine. |
| 16 | 25 | ||
| 17 | Credit goes to @jola5 for first implementing this awesome idea. | 26 | Credit goes to [jola5](https://github.com/jola5) for first implementing this awesome idea. |
| 18 | 27 | ||
| 19 | ## Custom Keycodes | 28 | ## [Custom Keycodes](#custom-keycodes) |
| 20 | Declared in `process_records.h` and `template.h` and defined in `process_record_user` in template.c | 29 | Declared in `process_records.h` and `template.h` and defined in `process_record_user` in template.c |
| 21 | 30 | ||
| 22 | ## Tap Dances | 31 | ## [Tap Dances](#tap-dances) |
| 23 | Set `TAP_DANCE_ENABLE = yes` in rules.mk. See file tap_dances.{c,h} | 32 | To enable set `TAP_DANCE_ENABLE = yes` in *rules.mk*. See file *tap_dances.{c,h}* |
| 33 | |||
| 34 | TODO: Command-line movement stuff is a pain when typing normally | ||
| 35 | |||
| 36 | TODO: Make use of `TD_SPC` and `TD_QT{1..3}` | ||
| 37 | |||
| 38 | ## [Leader Key](#leader-key) | ||
| 39 | To enable set `LEADER_ENABLE = yes` in file *rules.mk* | ||
| 40 | |||
| 41 | |LEADER_DICTIONARY()|program| description | | ||
| 42 | |---|---|---| | ||
| 43 | | W |vim/tmux| save file, switch pane and repeat last command | | ||
| 44 | | T |tmux| send default prefix | | ||
| 45 | | A |tmux| switch pane| | ||
| 46 | |T + T|tmux| send default prefix to a nested session | | ||
| 47 | |T + R|tmux| switch pane and repeat last command | | ||
| 48 | |V + Z|vim | zoom current split| | ||
| 49 | |V + R|vim | search and replace| | ||
| 50 | |V + T|vim | move current split to its own tab| | ||
| 51 | |3x Backspace|keyboard| Reset Keyboard | | ||
| 52 | |||
| 53 | `LEADER_DICTIONARY()` is defined in *leader.c* | ||
| 54 | |||
| 55 | ## [Combo Keys](#combo-keys) | ||
| 56 | To enable set `COMBO_ENABLE = yes` in file *rules.mk*. | ||
| 57 | Number of combos and timeout are defined in *config.h* | ||
| 58 | |||
| 59 | Press key chord to use. | ||
| 60 | |||
| 61 | |Combo|description | | ||
| 62 | |---|---| | ||
| 63 | | CV | Paste | | ||
| 64 | | XC | Cut | | ||
| 65 | | ZV | Copy | | ||
| 66 | | QP | KC_SLEEP | | ||
| 24 | 67 | ||
| 25 | ## Leader Key | 68 | Combos are defined in *combo.h* and *combo.c* |
| 26 | Set `LEADER_ENABLE = yes` in rules.mk. | 69 | |
| 27 | TODO: document tmux / vim / os | 70 | ## [Unicode](#unicode) |
| 71 | To enable set `UNICODE_ENABLE = yes` or `UNICODEMAP_ENABLE = yes` in file *rules.mk* | ||
| 72 | |||
| 73 | ## [Encoders](#encoders) | ||
| 74 | To enable set `ENCODER_ENABLE = yes` in *rules.mk*. | ||
| 75 | |||
| 76 | In the keyboard's *config.h* adjust according to your keyboard: | ||
| 77 | |||
| 78 | ```c | ||
| 79 | // Example ProMicro | ||
| 80 | #define ENCODERS_PAD_A { F4 } //PIN A3 | ||
| 81 | #define ENCODERS_PAD_B { F5 } //PIN A2 | ||
| 82 | ``` | ||
| 83 | |||
| 84 | Check the [documentation](https://docs.qmk.fm/#/feature_encoders) for more information | ||
| 85 | The first rotary encoder is configured such as: | ||
| 86 | |||
| 87 | |Modifier|description| | ||
| 88 | |---|---| | ||
| 89 | | None | General navigation. Page up/down | | ||
| 90 | | SHIFT | Fast navigation. Home/end | | ||
| 91 | | CTRL | Vertical navigation. Up/down | | ||
| 92 | | CTRL+SHIFT | Horizontal navigation. Left/right | | ||
| 93 | | ALT | Audio volume control. | | ||
| 94 | | GUI | Browser navigation(windows). Forward/backward | | ||
| 95 | | ALT+SHIFT | Form navigation. Tab up/down | | ||
| 96 | | ALT+CTRL | Media control. (Play|pause)/mute | | ||
| 97 | | HYPER | Media navigation. Next/prev track | | ||
| 98 | |||
| 99 | Key codes are stored as `uint16_t encoder_actions[2][9]` in *encoder.c* | ||
| 28 | 100 | ||
| 29 | ## Unicode | ||
| 30 | TODO: Set `idk` in `idc` | ||
| 31 | 101 | ||
| 32 | ## Diablo Layer | 102 | ## Diablo Layer |
| 33 | Currently not in use. | 103 | Currently not in use. |
| 104 | [Back to Top](#table-of-contents) | ||
| 34 | 105 | ||
| 35 | # Secret Macros | 106 | # [Secret Macros](#secret-macros) |
| 36 | Set `NO_SECRETS = yes` in rules.mk. | 107 | To enable set `NO_SECRETS = yes` in *rules.mk*. |
| 37 | 108 | ||
| 38 | With help from gitter and Colinta, this adds the ability to add hidden macros from other users. | 109 | With help from gitter and Colinta, this adds the ability to add hidden macros from other users. |
| 39 | 110 | ||
| 40 | First, I have several files that are hidden/excluded from Git/GitHub. These contain everything needed for the macros. To hide these files, open `.git/info/exclude` and add `secrets.c` and `secrets.h` to that file, below the comments. | 111 | First, I have several files that are hidden/excluded from Git/GitHub. These contain everything needed for the macros. To hide these files, open *.git/info/exclude* and add `secrets.c` and `secrets.h` to that file, below the comments. |
| 41 | 112 | ||
| 42 | And this requires `KC_SECRET_1` through `KC_SECRET_5` to be defined in your `<name>.h` file to define the keycodes for the new macros. | 113 | And this requires `KC_SECRET_1` through `KC_SECRET_5` to be defined in your *<name>.h* file to define the keycodes for the new macros. |
| 43 | 114 | ||
| 44 | 115 | ||
| 45 | ### .git/info/exclude | 116 | ### .git/info/exclude |
| 46 | 117 | ||
| 47 | ``` | 118 | ```console |
| 48 | # git ls-files --others --exclude-from=.git/info/exclude | 119 | # git ls-files --others --exclude-from=.git/info/exclude |
| 49 | # Lines that start with '#' are comments. | 120 | # Lines that start with '#' are comments. |
| 50 | # For a project mostly in C, the following would be a good set of | 121 | # For a project mostly in C, the following would be a good set of |
| 51 | # exclude patterns (uncomment them if you want to use them): | 122 | # exclude patterns (uncomment them if you want to use them): |
| 52 | # *.[oa] | 123 | # *.[oa] |
| 53 | # *~ | 124 | # *~ |
| 54 | /users/kuchosauronad0/secrets.c | 125 | /users/<name>/secrets.c |
| 55 | /users/kuchosauronad0/secrets.h | 126 | /users/<name>/secrets.h |
| 56 | ``` | 127 | ``` |
| 57 | 128 | ||
| 58 | Then you can create these files: | 129 | Then you can create these files: |
| @@ -60,7 +131,7 @@ Then you can create these files: | |||
| 60 | ### secrets.c | 131 | ### secrets.c |
| 61 | 132 | ||
| 62 | ```c | 133 | ```c |
| 63 | #include "kuchosauronad0.h" // replace with your keymap's "h" file, or whatever file stores the keycodes | 134 | #include "<name>.h" // replace <name> with your keymap's "h" file, or whatever file stores the keycodes |
| 64 | 135 | ||
| 65 | #if (__has_include("secrets.h") && !defined(NO_SECRETS)) | 136 | #if (__has_include("secrets.h") && !defined(NO_SECRETS)) |
| 66 | #include "secrets.h" | 137 | #include "secrets.h" |
| @@ -106,7 +177,7 @@ Replacing the strings with the codes that you need. | |||
| 106 | 177 | ||
| 107 | ### name.c | 178 | ### name.c |
| 108 | 179 | ||
| 109 | In the `<name>.c` file, you will want to add this to the top: | 180 | In the *<name>.c* file, you will want to add this to the top: |
| 110 | 181 | ||
| 111 | ```c | 182 | ```c |
| 112 | __attribute__ ((weak)) | 183 | __attribute__ ((weak)) |
| @@ -126,7 +197,7 @@ And then, in the `process_record_user` function, assuming you have `return proce | |||
| 126 | 197 | ||
| 127 | ### rules.mk | 198 | ### rules.mk |
| 128 | 199 | ||
| 129 | Here, you want your `/users/<name>/rules.mk` file to "detect" the existence of the `secrets.c` file, and only add it if the file exists. To do so, add this block: | 200 | Here, you want your */users/<name>/rules.mk* file to "detect" the existence of the *secrets.c* file, and only add it if the file exists. To do so, add this block: |
| 130 | 201 | ||
| 131 | ```make | 202 | ```make |
| 132 | ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") | 203 | ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") |
| @@ -134,7 +205,7 @@ ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") | |||
| 134 | endif | 205 | endif |
| 135 | ``` | 206 | ``` |
| 136 | 207 | ||
| 137 | Additionally, if you want to make sure that you can disable the function without messing with the file, you need to add this to your `/users/<name>/rules.mk`, so that it catches the flag: | 208 | Additionally, if you want to make sure that you can disable the function without messing with the file, you need to add this to your */users/<name>/rules.mk*, so that it catches the flag: |
| 138 | 209 | ||
| 139 | ```make | 210 | ```make |
| 140 | ifeq ($(strip $(NO_SECRETS)), yes) | 211 | ifeq ($(strip $(NO_SECRETS)), yes) |
| @@ -142,4 +213,5 @@ ifeq ($(strip $(NO_SECRETS)), yes) | |||
| 142 | endif | 213 | endif |
| 143 | ``` | 214 | ``` |
| 144 | 215 | ||
| 145 | Then, if you run `make keyboard:name NO_SECRETS=yes`, it will default to the test strings in your `<name>.c` file, rather than reading from your file. | 216 | Then, if you run `make keyboard:name NO_SECRETS=yes`, it will default to the test strings in your *<name>.c* file, rather than reading from your file. |
| 217 | [Back to Top](#table-of-contents) | ||
diff --git a/users/kuchosauronad0/rules.mk b/users/kuchosauronad0/rules.mk index 8610a9b7a..ad1308373 100644 --- a/users/kuchosauronad0/rules.mk +++ b/users/kuchosauronad0/rules.mk | |||
| @@ -14,6 +14,9 @@ endif | |||
| 14 | ifeq ($(strip $(ENCODER_ENABLE)), yes) | 14 | ifeq ($(strip $(ENCODER_ENABLE)), yes) |
| 15 | SRC += encoder.c | 15 | SRC += encoder.c |
| 16 | endif | 16 | endif |
| 17 | ifeq ($(strip $(COMBO_ENABLE)), yes) | ||
| 18 | SRC += combo.c | ||
| 19 | endif | ||
| 17 | 20 | ||
| 18 | ifeq ($(strip $(LEADER_ENABLE)), yes) | 21 | ifeq ($(strip $(LEADER_ENABLE)), yes) |
| 19 | SRC += leader.c | 22 | SRC += leader.c |
diff --git a/users/kuchosauronad0/tap_dances.c b/users/kuchosauronad0/tap_dances.c index 4ebb5dc73..7bdd3d337 100644 --- a/users/kuchosauronad0/tap_dances.c +++ b/users/kuchosauronad0/tap_dances.c | |||
| @@ -1,14 +1,12 @@ | |||
| 1 | #include "tap_dances.h" | 1 | #include "tap_dances.h" |
| 2 | void td_parenthesis (qk_tap_dance_state_t *state, void *user_data) { | 2 | void td_parenthesis (qk_tap_dance_state_t *state, void *user_data) { |
| 3 | if (state->count == 1) { | 3 | if (state->count == 1) { |
| 4 | SEND_STRING ("\("); | 4 | // SEND_STRING ("\("); |
| 5 | tap_code(KC_QUOT); | ||
| 5 | reset_tap_dance (state); | 6 | reset_tap_dance (state); |
| 6 | } | 7 | } |
| 7 | else if (state->count == 2) { | 8 | else if (state->count == 2) { |
| 8 | SEND_STRING("()" SS_TAP(X_LEFT)); | 9 | SEND_STRING("()" SS_TAP(X_LEFT)); |
| 9 | //tap_code(KC_2); | ||
| 10 | //tap_code(KC_3); | ||
| 11 | //tap_code(KC_LEFT); | ||
| 12 | reset_tap_dance (state); | 10 | reset_tap_dance (state); |
| 13 | } | 11 | } |
| 14 | else if (state->count == 3) { | 12 | else if (state->count == 3) { |
