diff options
author | Artjoms Rizihs <artjomsR@users.noreply.github.com> | 2022-10-10 01:04:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-10 01:04:30 -0700 |
commit | cd4a265560b45d117ac8296887188015c907e3c8 (patch) | |
tree | b33715262450507840c75b501b559719070e167a | |
parent | 7aab5e4d896606a7731c8adfce41115611df75c2 (diff) |
[Keyboard][Keymap] Fix random keys being sent on Mac + userspace changes (#15648)
* qmk art 2020+
* fix compilation
* remove functions. translation matrix
* fix edgecases
* whitespace
* fix memory oddity changing the keymap with every string print
* return edge cases
* support workman layout for git strings
* subm
* secrets
* fix git ignore
* rename var
* workman HW feature toggle
* remember lenght for inserting secrets
* blink leds on secret finish
* 75:fix LEDs not reflecting state on boot
* move common led functions to user file
* move common led funcs to separate file
* move funcs file to separate folder
* capsword
* move string functions to a separate file
* consolidate led funcs
* tidy up variables
* email
* fix printing random keys on Mac + temp disable dynamic macro
* make switch lang shortcut configurable
* revert ergodone behaviour
* move git ignore to userspace folder
* ergodone clean up + saving space
* navigation combos
* shift caps always turns on caps lock. more combos
* convert led funcs into header file
* convert string funcs into header file
* fix compilation for split75
* remove git cherry pick
* update legal headers
* more legal headers
* home row macros
* refactor combo names
* redo combos for homerow + f10 11 12
* custom strings implementation (like secrets)
* ergodone: more consistent f keys
* tweak left right combos to minimise typing interference
* ctr z shortcut
* ergodone: move del to a more convenient key
* rename secrets file to a shorter length
* ergodone tweaks
* fix after merge
* removed included .c files
* Update keyboards/ktec/ergodone/keymaps/art/user_config.c.example
* Update keyboards/mt/split75/keymaps/art/user_config.c.example
* Update users/art/secr.h.example
* Update users/art/custom_definitions.h.example
* Update users/art/art_user_config.h.example
* Update users/art/art.h
25 files changed, 1242 insertions, 456 deletions
diff --git a/keyboards/ktec/ergodone/keymaps/art/.gitignore b/keyboards/ktec/ergodone/keymaps/art/.gitignore new file mode 100644 index 0000000000..46bb98e431 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/art/.gitignore @@ -0,0 +1 @@ +*user_config.c
\ No newline at end of file diff --git a/keyboards/ktec/ergodone/keymaps/art/keymap.c b/keyboards/ktec/ergodone/keymaps/art/keymap.c index 7fcbd5b615..d43a340769 100644 --- a/keyboards/ktec/ergodone/keymaps/art/keymap.c +++ b/keyboards/ktec/ergodone/keymaps/art/keymap.c @@ -1,68 +1,51 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + #include "art.h" #include "sendstring_workman_zxcvm.h" -bool is_win = true; - enum custom_keycodes { keyboardSpecificKeyCode = NEW_SAFE_RANGE //not used }; -void led_show_current_os(void) { - if (is_win) { - ergodox_right_led_1_on(); - wait_ms(50); - ergodox_right_led_1_off(); - wait_ms(50); - ergodox_right_led_1_on(); - wait_ms(50); - ergodox_right_led_1_off(); - wait_ms(50); - ergodox_right_led_1_on(); - wait_ms(50); - ergodox_right_led_1_off(); - wait_ms(50); - } else { - ergodox_right_led_3_on(); - wait_ms(50); - ergodox_right_led_3_off(); - wait_ms(50); - ergodox_right_led_3_on(); - wait_ms(50); - ergodox_right_led_3_off(); - wait_ms(50); - ergodox_right_led_3_on(); - wait_ms(50); - ergodox_right_led_3_off(); - wait_ms(50); - } +void num_led_on(void) { + ergodox_right_led_1_on(); } -void matrix_init_user(void) { - led_show_current_os(); +void num_led_off(void) { + ergodox_right_led_1_off(); } -void led_set_user(uint8_t usb_led) { - if (usb_led & (1<<USB_LED_CAPS_LOCK)) { - ergodox_right_led_2_on(); - } else { - ergodox_right_led_2_off(); - } +void caps_led_on(void) { + ergodox_right_led_2_on(); } +void caps_led_off(void) { + ergodox_right_led_2_off(); +} +void scroll_led_on(void) { + ergodox_right_led_3_on(); +} -layer_state_t layer_state_set_user(layer_state_t state) { - ergodox_board_led_off(); - ergodox_right_led_1_off(); +void scroll_led_off(void) { ergodox_right_led_3_off(); +} + +layer_state_t layer_state_set_user(layer_state_t state) { + num_led_off(); + scroll_led_off(); switch (get_highest_layer(state)) { + case MEDIA: + case WORKMAN: + scroll_led_on(); case NAV: case CTRL_NAV: case SHIFT_NAV: - ergodox_right_led_1_on(); + num_led_on(); break; case FKEYS: - ergodox_right_led_3_on(); + scroll_led_on(); break; } return state; @@ -74,13 +57,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,--------------------------------------------------. ,--------------------------------------------------. * | ` ~ | 1 | 2 | 3 | 4 | 5 | ESC | | - _ | 6 | 7 | 8 | 9 | 0 | ] | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | Tab | Q | W | E | R | T | ??? | | = | Y | U | I | O | P | [ | + * | Tab | Q | W | E | R | T | \ | | = | Y | U | I | O | P | [ | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * | Caps | A | S | D | F | G |------| |------| H | J | K | L | ; | ' | * |--------+------+------+------+------+------| FKEYS| | FKEYS|------+------+------+------+------+--------| * | LShift | Z | X | C | V | B | | | | N | M | , | . | / git| RShift | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * |LCtrl |Media\| Win |Alt | NAV | | Home | End |Workmn| | RCtrl| + * | <- | -> | Win |Alt | ctrl | | Home | End |Workmn| | RCtrl| * `----------------------------------' `----------------------------------' * ,-------------. ,---------------. * | Del | Ins | | Left | Right | @@ -93,27 +76,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [QWERTY] = LAYOUT_ergodox( // -----------------------------------------------------left hand----------------------------------------------------- KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESCAPE, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, XXXXXXX, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_BSLASH, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, TT(FKEYS), - KC_LCTRL, LT(MEDIA, KC_BSLASH), KC_LWIN, KC_LALT, LT(NAV, KC_RIGHT), + KC_LEFT, KC_RIGHT, KC_LWIN, KC_LALT, KC_LCTRL, - KC_DEL, KC_INS, - KC_PGUP, - KC_SPC, LT(COMBOS,KC_BSPC), KC_PGDOWN, + KC_INS, KC_PGUP, + LT(MEDIA,KC_PGDOWN), + LT(NAV,KC_SPC), KC_BSPC, LT(COMBOS,KC_DEL), // -----------------------------------------------------right hand----------------------------------------------------- KC_MINS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_RBRC, KC_EQL, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, TT(FKEYS), KC_N, KC_M, KC_COMM, KC_DOT, LT(GIT,KC_SLSH), KC_RSFT, - KC_HOME, KC_END, DF(WORKMAN), KC_RALT, KC_RCTRL, + KC_HOME, KC_END, TO(WORKMAN), KC_RALT, KC_RCTRL, KC_LEFT, KC_RIGHT, LT(SHIFT_NAV, KC_UP), - LT(CTRL_NAV, KC_DOWN), MO(NAV), KC_ENT + LT(CTRL_NAV, KC_DOWN), TT(NAV), KC_ENT ), - /* Workman +/* Workman * * ,--------------------------------------------------. ,--------------------------------------------------. * | | | | | | | | | | | | | | | | @@ -134,7 +117,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | * `--------------------' `----------------------' */ -[WORKMAN] = LAYOUT_ergodox( +[WORKMAN] = LAYOUT_ergodox( // -----------------------------------------------------left hand----------------------------------------------------- _______, _______, _______, _______, _______, _______, _______, _______, KC_Q, KC_D, KC_R, KC_W, KC_B, _______, @@ -150,8 +133,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, KC_J, KC_F, KC_U, KC_P, KC_SCLN, _______, KC_Y, KC_N, KC_E, KC_O, KC_I, _______, - _______, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______, - _______, _______, DF(QWERTY), _______, _______, + _______, KC_K, KC_L, _______, _______, _______, _______, + _______, _______, TO(QWERTY), _______, _______, _______, _______, _______, @@ -160,8 +143,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [FKEYS] = LAYOUT_ergodox( // -----------------------------------------------------left hand----------------------------------------------------- - _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, - _______, _______, _______, _______, _______, _______, _______, + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, + _______, _______, _______, _______, _______, _______, KC_LALT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -170,11 +153,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, // -----------------------------------------------------right hand----------------------------------------------------- - _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, - _______, _______, _______, _______, _______, _______, KC_F12, - _______, _______, _______, _______, _______, KC_PSCREEN, - _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, + _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + KC_LALT, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, KC_F11, + _______, _______, _______, KC_PSCREEN, KC_F12, _______, _______, _______, @@ -183,20 +166,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [NAV] = LAYOUT_ergodox( // -----------------------------------------------------left hand----------------------------------------------------- - _______, LALT(KC_F1), LALT(KC_F2), LALT(KC_F3), LALT(KC_F4), LALT(KC_F5), _______, - _______, _______, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, - _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDOWN, - _______, _______, _______, _______, KC_LALT, _______, _______, - _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, KC_ESC, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, + _______, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDOWN, + _______, LCTL(KC_Z), LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), XXXXXXX, _______, + _______, _______, _______, _______, _______, _______, _______, _______, - _______, KC_DEL, _______, + KC_DEL, _______, _______, // -----------------------------------------------------right hand----------------------------------------------------- - _______, LALT(KC_F6), LALT(KC_F7), LALT(KC_F8), LALT(KC_F9), LALT(KC_F10), LALT(KC_F11), - _______, _______, _______, _______, _______, _______, LALT(KC_F12), - _______, CTR_ALT, KC_RSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, XXXXXXX, KC_MS_BTN1, KC_MS_BTN3, KC_MS_BTN2, _______, _______, + KC_APP, CTR_ALT, KC_RSFT, CTR_ALT_SHIFT, _______, _______, + _______, XXXXXXX, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -209,7 +192,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, CTL_ALT(KC_HOME), CTL_ALT(KC_UP), CTL_ALT(KC_END), CTL_ALT(KC_PGUP), _______, _______, _______, CTL_ALT(KC_LEFT), CTL_ALT(KC_DOWN), CTL_ALT(KC_RIGHT),CTL_ALT(KC_PGDOWN), - _______, _______, CTL_ALT(KC_X), CTL_ALT(KC_C), CTL_ALT(KC_V), _______, _______, + _______, _______, LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), _______, _______, _______, _______, _______, _______, _______, CTL_ALT(KC_DEL), _______, @@ -232,7 +215,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, LSFT(KC_HOME), LSFT(KC_UP), LSFT(KC_END), LSFT(KC_PGUP), _______, _______, _______, LSFT(KC_LEFT), LSFT(KC_DOWN), LSFT(KC_RIGHT), LSFT(KC_PGDOWN), - _______, _______, _______, _______, _______, _______, _______, + _______, _______, LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -252,12 +235,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { CTR_ALT, _______, _______ ), -[COMBOS] = LAYOUT_ergodox( +[COMBOS] = LAYOUT_ergodox( // -----------------------------------------------------left hand----------------------------------------------------- - TILD_BLOCK, PRESCRIPTION, _______, _______, FOURS, _______, _______, - _______, _______, _______, _______, _______, _______, _______, - _______, ADMINS, SARCASM, _______, CTRL_CTV, _______, - _______, _______, _______, _______, _______, _______, _______, + TILD_BLOCK, _______, QUOTES_RU, K_CUST1, K_CUST2, K_CUST3, _______, + _______, _______, _______, NEUTRAL_COPY, _______, BEAT_BROWSER, _______, + _______, ADMINS, SARCASM, ALL_BEST, CTRL_CTV, _______, + _______, _______, _______, CTRL_CAV, _______, LMB_SPAM, _______, _______, _______, _______, _______, _______, _______, _______, @@ -265,9 +248,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, // -----------------------------------------------------right hand----------------------------------------------------- - _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, + DASHES, _______, _______, STARS, PARENTHS, _______, TOG_OS, + _______, K_SECR1, K_SECR2, K_SECR3, K_SECR4, _______, BRACES, + AT_EMAIL, _______, _______, _______, _______, QUOTES, _______, _______, CTRL_LCTV, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -276,7 +259,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______ ), -// [STRINGS] = LAYOUT_ergodox( +// [STRINGS] = LAYOUT_ergodox( // // -----------------------------------------------------left hand----------------------------------------------------- // _______, _______, _______, _______, _______, _______, _______, // _______, _______, _______, _______, _______, _______, _______, @@ -300,12 +283,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // _______, _______, _______ // ), -[MEDIA] = LAYOUT_ergodox( +[MEDIA] = LAYOUT_ergodox( // -----------------------------------------------------left hand----------------------------------------------------- _______, _______, _______, _______, _______, _______, _______, - _______, _______, KC_MPRV, KC_VOLU, KC_MNXT, _______, _______, - _______, _______, _______, KC_VOLD, _______, _______, - _______, _______, _______, KC_MUTE, KC_MPLY, _______, _______, + XXXXXXX, KC_MPRV, KC_VOLU, KC_MNXT, _______, _______, _______, + _______, _______, KC_VOLD, _______, _______, _______, + _______, _______, KC_MUTE, KC_MPLY, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -315,7 +298,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // -----------------------------------------------------right hand----------------------------------------------------- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, TOG_OS, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -324,12 +307,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______ ), -[GIT] = LAYOUT_ergodox( +[GIT] = LAYOUT_ergodox( // -----------------------------------------------------left hand----------------------------------------------------- _______, _______, _______, _______, _______, _______, _______, - _______, _______, G_DIFF, G_RST, _______, G_BRCH, _______, + _______, _______, G_DIFF, G_R, _______, G_BRCH, _______, _______, G_ADD, G_S, _______, _______, _______, - _______, _______, _______, G_C, _______, G_MERG, _______, + _______, G_DEV, _______, G_C, _______, G_MERG, _______, _______, _______, _______, _______, _______, _______, _______, @@ -338,9 +321,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // -----------------------------------------------------right hand----------------------------------------------------- _______, _______, _______, _______, _______, _______, _______, - _______, _______, G_FTCH, _______, G_P, _______, _______, + _______, _______, G_FTCH, G_PULL, G_PUSH, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, G_LOG, _______, G_DEV, _______, _______, + _______, _______, G_LOG, _______, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -348,13 +331,37 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______ ), -[GIT_C] = LAYOUT_ergodox( +[GIT_C] = LAYOUT_ergodox( // -----------------------------------------------------left hand----------------------------------------------------- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_CHEC, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + + XXXXXXX, XXXXXXX, + XXXXXXX, + XXXXXXX, KC_BSPC, XXXXXXX, + + // -----------------------------------------------------right hand----------------------------------------------------- + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, G_COMM, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + + XXXXXXX, XXXXXXX, + XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX +), + +[GIT_R] = LAYOUT_ergodox( + // -----------------------------------------------------left hand----------------------------------------------------- + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_RBASE, XXXXXXX, + XXXXXXX, XXXXXXX, G_RST, XXXXXXX, XXXXXXX, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, G_RVERT, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, @@ -365,20 +372,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_COMM, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX ), -[GIT_S] = LAYOUT_ergodox( +[GIT_S] = LAYOUT_ergodox( // -----------------------------------------------------left hand----------------------------------------------------- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_STSH, G_SHOW, G_STAT, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, @@ -389,7 +396,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_COMM, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, @@ -412,7 +419,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `----------------------------------' */ -// [] = LAYOUT_ergodox( +// [] = LAYOUT_ergodox( // // -----------------------------------------------------left hand----------------------------------------------------- // _______, _______, _______, _______, _______, _______, _______, // _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/ktec/ergodone/keymaps/art/rules.mk b/keyboards/ktec/ergodone/keymaps/art/rules.mk new file mode 100644 index 0000000000..e1e10174a2 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/art/rules.mk @@ -0,0 +1 @@ +SRC += user_config.c diff --git a/keyboards/ktec/ergodone/keymaps/art/user_config.c.example b/keyboards/ktec/ergodone/keymaps/art/user_config.c.example new file mode 100644 index 0000000000..baa169f9a3 --- /dev/null +++ b/keyboards/ktec/ergodone/keymaps/art/user_config.c.example @@ -0,0 +1,6 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +bool is_win = true; diff --git a/keyboards/mt/split75/config.h b/keyboards/mt/split75/config.h index dce3f6eea8..b146d03314 100644 --- a/keyboards/mt/split75/config.h +++ b/keyboards/mt/split75/config.h @@ -1,3 +1,6 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once /* matrix size */ @@ -13,3 +16,5 @@ #define RGBLIGHT_SLEEP #define BACKLIGHT_PIN D4 + +#define I2C_START_RETRY_COUNT 1
\ No newline at end of file diff --git a/keyboards/mt/split75/keymaps/art/.gitignore b/keyboards/mt/split75/keymaps/art/.gitignore new file mode 100644 index 0000000000..46bb98e431 --- /dev/null +++ b/keyboards/mt/split75/keymaps/art/.gitignore @@ -0,0 +1 @@ +*user_config.c
\ No newline at end of file diff --git a/keyboards/mt/split75/keymaps/art/config.h b/keyboards/mt/split75/keymaps/art/config.h new file mode 100644 index 0000000000..30d493075a --- /dev/null +++ b/keyboards/mt/split75/keymaps/art/config.h @@ -0,0 +1,10 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#undef RGBLIGHT_ANIMATIONS +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_STATIC_GRADIENT + +// #define DYNAMIC_MACRO_SIZE 48
\ No newline at end of file diff --git a/keyboards/mt/split75/keymaps/art/keymap.c b/keyboards/mt/split75/keymaps/art/keymap.c index c10059bb7d..25a58ee591 100644 --- a/keyboards/mt/split75/keymaps/art/keymap.c +++ b/keyboards/mt/split75/keymaps/art/keymap.c @@ -1,64 +1,50 @@ -#include <art.h> -#include <sendstring_workman_zxcvm.h> +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later -bool is_win = false; +#include "art.h" +#include "sendstring_workman_zxcvm.h" enum custom_keycodes { keyboardSpecificKeyCode = NEW_SAFE_RANGE //not used atm }; -bool led_update_user(led_t led_state) { - writePin(CAPSLOCK_LED_PIN, led_state.caps_lock); - return false; +void num_led_on(void) { + writePinHigh(LED_NUM_LOCK_PIN); } -void led_show_current_os(void) { - if (is_win) { - writePinHigh(NUMLOCK_LED_PIN); - wait_ms(50); - writePinLow(NUMLOCK_LED_PIN); - wait_ms(50); - writePinHigh(NUMLOCK_LED_PIN); - wait_ms(50); - writePinLow(NUMLOCK_LED_PIN); - wait_ms(50); - writePinHigh(NUMLOCK_LED_PIN); - wait_ms(50); - writePinLow(NUMLOCK_LED_PIN); - wait_ms(50); - } else { - writePinHigh(SCROLLLOCK_LED_PIN); - wait_ms(50); - writePinLow(SCROLLLOCK_LED_PIN); - wait_ms(50); - writePinHigh(SCROLLLOCK_LED_PIN); - wait_ms(50); - writePinLow(SCROLLLOCK_LED_PIN); - wait_ms(50); - writePinHigh(SCROLLLOCK_LED_PIN); - wait_ms(50); - writePinLow(SCROLLLOCK_LED_PIN); - wait_ms(50); - } +void num_led_off(void) { + writePinLow(LED_NUM_LOCK_PIN); +} + +void caps_led_on(void) { + writePinHigh(LED_CAPS_LOCK_PIN); +} + +void caps_led_off(void) { + writePinLow(LED_CAPS_LOCK_PIN); } -void keyboard_pre_init_user(void) { - led_show_current_os(); - - layer_state_set_user(layer_state); +void scroll_led_on(void) { + writePinHigh(LED_SCROLL_LOCK_PIN); +} + +void scroll_led_off(void) { + writePinLow(LED_SCROLL_LOCK_PIN); } layer_state_t layer_state_set_user(layer_state_t state) { - writePinLow(NUMLOCK_LED_PIN); - writePinLow(SCROLLLOCK_LED_PIN); + num_led_off(); + scroll_led_off(); switch (get_highest_layer(state)) { case MEDIA: - writePinHigh(SCROLLLOCK_LED_PIN); + case WORKMAN: + scroll_led_on(); case BASE: - writePinHigh(NUMLOCK_LED_PIN); + case NAV: + num_led_on(); break; case NUMPAD: - writePinHigh(SCROLLLOCK_LED_PIN); + scroll_led_on(); break; } return state; @@ -82,12 +68,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [QWERTY] = LAYOUT( //--------------------------------Left Hand------------------------------------| |--------------------------------Right Hand------------------------------------------------ - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, LT(CONFIG, KC_PSCR), KC_INS, KC_HOME, + KC_ESC, KC_MPLY, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, LT(CONFIG, KC_PSCR), KC_INS, KC_HOME, KC_VOLD,KC_VOLU, KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQUAL, KC_BSPC, KC_DEL, KC_MPRV,KC_MNXT, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_END, KC_HOME,KC_END, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_ENTER, KC_PGUP, -DYN_MACRO_PLAY1,MO(STRINGS),KC_LSFT,KC_Z,KC_X,KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, LT(GIT,KC_SLSH), KC_RSFT, KC_UP, KC_PGDN, -DYN_REC_STOP,DYN_REC_START1,KC_LCTL, KC_LGUI, KC_LALT, LT(MEDIA,KC_SPC), LT(COMBOS,KC_BSPC), LT(NAV, KC_ENTER), KC_RALT, MO(LAYOUT_CHG),KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT +DYN_MACRO_PLAY1,KC_MUTE,KC_LSFT,KC_Z,KC_X,KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, LT(GIT,KC_SLSH), KC_RSFT, KC_UP, KC_PGDN, +DYN_REC_STOP,DYN_REC_START1,KC_LCTL, KC_LGUI, KC_LALT, LT(MEDIA,KC_SPC), LT(COMBOS,KC_BSPC), LT(NAV,KC_APP), LT(LAYOUT_CHG, KC_ENTER),KC_RALT,KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT ), /* Base ,-----------------------------------------. ,-----------------------------------------------------. @@ -111,7 +97,7 @@ KC_8, KC_9, KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_6, KC_7, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_END, KC_4, KC_5, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENTER, KC_PGUP, KC_2, KC_3, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, -KC_0, KC_1, OS_CTRL, OS_WIN, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(QWERTY_MOD), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT +KC_0, KC_1, OS_CTRL, OS_WIN, KC_LALT, KC_SPC, KC_SPC, KC_SPC, MO(QWERTY_MOD), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT ), [WORKMAN] = LAYOUT( @@ -121,19 +107,19 @@ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, _______, _______, _______, _______, _______, _______, _______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______, _______, _______, _______, _______, _______, KC_Z, KC_X, KC_C, KC_V, KC_M, KC_K, KC_L, KC_COMM, KC_DOT, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, TO(QWERTY), _______, _______, _______, _______ +_______, _______, _______, _______, _______, _______, LT(COMBOS,KC_BSPC), LT(NAV,KC_APP), LT(LAYOUT_CHG, KC_ENTER), TO(QWERTY), _______, _______, _______, _______ ), - + [NAV] = LAYOUT( //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_8, KC_9, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -KC_6, KC_7, _______, _______, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, _______, _______, _______, _______, _______, _______, _______, _______, -KC_4, KC_5, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDOWN, _______, CTR_ALT, KC_RSFT, _______, _______, _______, _______, _______, -KC_2, KC_3, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, +KC_6, KC_7, _______, KC_ESC, KC_HOME, KC_UP, KC_END, KC_PGUP, XXXXXXX, KC_MS_BTN1, KC_MS_BTN3, KC_MS_BTN2, XXXXXXX, _______, _______, _______, _______, +KC_4, KC_5, _______, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDOWN, KC_APP, CTR_ALT, KC_RSFT, CTR_ALT_SHIFT, _______, _______, _______, _______, +KC_2, KC_3, _______, XXXXXXX, LCTL(KC_X),LCTL(KC_C),LCTL(KC_V), XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, _______, _______, KC_0, KC_1, _______, _______, _______, KC_DEL, _______, _______, _______, _______, _______, _______, _______, _______ ), - + [MEDIA] = LAYOUT( //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -141,57 +127,57 @@ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLU, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_MPLY, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - + [COMBOS] = LAYOUT( //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, SARCASM, _______, CTRL_CTV, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, CTRL_CAV, _______, _______, _______, CTRL_LCTV, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +_______, _______, TILD_BLOCK, _______, QUOTES_RU, K_CUST1, K_CUST2, K_CUST3, _______, _______, STARS, PARENTHS, _______, DASHES, _______, _______, _______, +_______, _______, _______, _______, _______, NEUTRAL_COPY, _______, BEAT_BROWSER, K_SECR1, K_SECR2, K_SECR3, K_SECR4, _______, BRACES, TOG_OS, _______, _______, +_______, _______, _______, ADMINS, SARCASM, ALL_BEST,CTRL_CTV, _______, AT_EMAIL, _______, _______, _______, _______, QUOTES, _______, _______, +_______, _______, _______, _______, _______, CTRL_CAV, _______, XXXXXXX, _______, CTRL_LCTV, _______, _______, _______, _______, _______, _______, +_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - - [STRINGS] = LAYOUT( -//--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, TILD_BLOCK, PRESCRIPTION, _______, _______, FOURS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, ADMINS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ - ), + +// [STRINGS] = LAYOUT( +// //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ +// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, +// _______, _______, TILD_BLOCK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, ADMINS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, +// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +// ), [QWERTY_MOD] = LAYOUT( //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLU, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_MPLY, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, TO(QWERTY),_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +_______, _______, TO(QWERTY),_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - + [LAYOUT_CHG] = LAYOUT( //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_F1, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, CTL_ALT(KC_HOME), CTL_ALT(KC_UP), CTL_ALT(KC_END), CTL_ALT(KC_PGUP), _______, _______,_______, _______,_______,_______,_______, _______, _______, _______, _______, _______, _______, CTL_ALT(KC_LEFT), CTL_ALT(KC_DOWN), CTL_ALT(KC_RIGHT), CTL_ALT(KC_PGDOWN), _______,_______,_______,_______,_______, _______, _______, _______, -_______, _______, TO(WORKMAN), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, +_______, _______, TO(WORKMAN), LCTL(KC_Z), LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), _______, _______, _______, _______, _______, _______, _______, _______, _______, TO(NUMPAD), TO(NUMPAD), TO(BASE), _______, _______, _______, CTL_ALT(KC_BSPC), KC_LSFT, _______, _______, _______, _______, _______, _______ - ), - + ), + [CONFIG] = LAYOUT( //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -RGB_VAI, RGB_VAD, RGB_MODE_PLAIN, RGB_MODE_BREATHE, RGB_MODE_RAINBOW, RGB_MODE_SWIRL, RGB_MODE_SNAKE, RGB_MODE_KNIGHT, RGB_MODE_XMAS, RGB_MODE_GRADIENT, RGB_MODE_RGBTEST, XXXXXXX, XXXXXXX, _______, _______, _______, _______, -RGB_SAI, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, _______, _______, TOG_OS, _______, _______, _______, _______, _______, -RGB_HUI, RGB_HUD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -RGB_MOD, RGB_RMOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +RGB_VAD, RGB_VAI, RGB_MODE_PLAIN, RGB_MODE_BREATHE, RGB_MODE_RAINBOW, RGB_MODE_SWIRL, RGB_MODE_SNAKE, RGB_MODE_KNIGHT, RGB_MODE_XMAS, RGB_MODE_GRADIENT, RGB_MODE_RGBTEST, XXXXXXX, XXXXXXX, _______, _______, _______, _______, +RGB_SAD, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______, _______, +RGB_HUD, RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, +RGB_RMOD, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, +RGB_TOG, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), [NUMPAD] = LAYOUT( @@ -203,17 +189,17 @@ KC_4, KC_5, _______, _______, _______, _______, _______, _______, KC_2, KC_3, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_0, KC_1, _______, _______, _______, _______, _______, _______, _______, TO(QWERTY),_______, _______, _______, _______ ), - + [GIT] = LAYOUT( //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, G_DIFF, G_RST, _______, G_BRCH, _______, G_FTCH, _______, G_P, _______, _______, _______, _______, _______, +_______, _______, _______, _______, G_DIFF, G_R, _______, G_BRCH, _______, G_FTCH, G_PULL, G_PUSH, _______, _______, _______, _______, _______, _______, _______, _______, G_ADD, G_S, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, G_C, _______, G_MERG, _______, G_LOG, _______, G_DEV, _______, _______, _______, _______, +_______, _______, _______, G_DEV, _______, G_C, _______, G_MERG, _______, G_LOG, _______, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - + [GIT_C] = LAYOUT( //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, @@ -221,9 +207,19 @@ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_CHEC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_COMM, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, -XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX + ), + + [GIT_R] = LAYOUT( +//--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, +XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, +XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_RBASE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, +XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, +XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, G_RVERT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, +XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX ), - + [GIT_S] = LAYOUT( //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, @@ -231,9 +227,9 @@ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_STSH, G_SHOW, G_STAT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, -XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX - ), - +XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX + ), + /* ,-----------------------------------------. ,-----------------------------------------------------. * | | | | | | | | | | | | | | | | | | * ,-----------. |-----+-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----+-----------+-----| @@ -255,7 +251,7 @@ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSPC, // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ // ), }; @@ -264,4 +260,4 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { } return true; -}
\ No newline at end of file +} diff --git a/keyboards/mt/split75/keymaps/art/rules.mk b/keyboards/mt/split75/keymaps/art/rules.mk index 5f8cb68ad0..cca8f0a79e 100644 --- a/keyboards/mt/split75/keymaps/art/rules.mk +++ b/keyboards/mt/split75/keymaps/art/rules.mk @@ -1 +1,3 @@ -DYNAMIC_MACRO_ENABLE = yes
\ No newline at end of file +SRC += user_config.c + +# DYNAMIC_MACRO_ENABLE = yes # doesn't work atm diff --git a/keyboards/mt/split75/keymaps/art/user_config.c.example b/keyboards/mt/split75/keymaps/art/user_config.c.example new file mode 100644 index 0000000000..baa169f9a3 --- /dev/null +++ b/keyboards/mt/split75/keymaps/art/user_config.c.example @@ -0,0 +1,6 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +bool is_win = true; diff --git a/keyboards/mt/split75/keymaps/default/keymap.c b/keyboards/mt/split75/keymaps/default/keymap.c index 320aaeb5da..5d060f11ca 100644 --- a/keyboards/mt/split75/keymaps/default/keymap.c +++ b/keyboards/mt/split75/keymaps/default/keymap.c @@ -1,3 +1,6 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + #include QMK_KEYBOARD_H enum layer_names { diff --git a/keyboards/mt/split75/split75.c b/keyboards/mt/split75/split75.c index b8a3fe6c28..890c9d1de3 100644 --- a/keyboards/mt/split75/split75.c +++ b/keyboards/mt/split75/split75.c @@ -1 +1,4 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + #include "split75.h" diff --git a/keyboards/mt/split75/split75.h b/keyboards/mt/split75/split75.h index 93da3e7b83..a01db5188e 100644 --- a/keyboards/mt/split75/split75.h +++ b/keyboards/mt/split75/split75.h @@ -1,3 +1,6 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #include "quantum.h" diff --git a/users/art/.gitignore b/users/art/.gitignore new file mode 100644 index 0000000000..c05ba7978b --- /dev/null +++ b/users/art/.gitignore @@ -0,0 +1,3 @@ +*user_config.* +custom_definitions.h +secr.h diff --git a/users/art/art.c b/users/art/art.c index 5596e237f8..151249ec3f 100644 --- a/users/art/art.c +++ b/users/art/art.c @@ -1,103 +1,116 @@ -#include "art.h" -#include "string.h" +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later -__attribute__ ((weak)) -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; -} +#include "art.h" +#include "custom_definitions.h" +#include "secr.h" +#include "funcs/led_funcs.h" +#include "funcs/string_funcs.h" -__attribute__ ((weak)) -void led_show_current_os(void) { -} +static const int COPY_DELAY = 50; +static const int INCOGNITO_DELAY = 500; +static const int LMB_SPAM_INTERVAL = 30; +static const uint8_t OS_MOD_KEYS[2] = {MOD_LALT, MOD_LCTL}; -static bool mac_ctrl_on = false; //for switching tabs -static bool mac_gui_on = false; //for switching languages -static bool mac_alt_tab_on = false; //for switching windows +bool mac_ctrl_on = false; //for switching tabs +bool mac_gui_on = false; //for switching languages +bool mac_alt_window_switching_on = false; //for switching windows -static const char *key_up[2] = {SS_UP(X_LALT), SS_UP(X_LCTL)}; -static const char *key_down[2] = {SS_DOWN(X_LALT), SS_DOWN(X_LCTL)}; +int char_to_bspace = 1; +int char_to_del = 0; -int char_to_del = 1; static bool sarcasm_on = false; static bool sarcasm_key = false; +static bool full_caps_mode = false; +bool hw_caps_on; -void backspace_n_times(int times) { - for (int i=0; i<times; i++) { - SEND_STRING(SS_TAP(X_BSPC)); - } -} +static bool is_lmb_timer_active = false; +static uint16_t lmb_timer = 0; -void send_string_remembering_length(char *string) { - send_string(string); - char_to_del = strlen(string); +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; } -void send_shifted_strings(char *string1, char *string2) { - if ( get_mods() & MOD_MASK_SHIFT ) { - clear_mods(); - send_string_remembering_length(string2); - } else { - send_string_remembering_length(string1); - } +void keyboard_post_init_user(void) { + led_show_variable_status(is_win); + layer_state_set_user(layer_state); } -void send_shifted_strings_add(char *string1, char *string2) { - bool shifted = get_mods() & MOD_MASK_SHIFT; - clear_mods(); - - send_string_remembering_length(string1); - - if (shifted) { - send_string(string2); - char_to_del = strlen(string1) + strlen(string2); +void matrix_scan_user(void) { + if (is_lmb_timer_active) { + if (timer_elapsed(lmb_timer) > LMB_SPAM_INTERVAL) { + SEND_STRING(SS_TAP(X_BTN1)); //do stuff that needs spamming + lmb_timer = timer_read(); + } } } -bool is_mac_with_base_layer_off(void) { - return !is_win && !layer_state_is(BASE); +bool caps_word_on(void) { + return hw_caps_on && !full_caps_mode; } + bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if (sarcasm_on) { - sarcasm_key = ! sarcasm_key; - if (sarcasm_key) { - SEND_STRING(SS_TAP(X_CAPS)); + if (record->event.pressed) { + if (sarcasm_on) { + sarcasm_key = ! sarcasm_key; + del_mods(MOD_LSFT); + if (sarcasm_key) { + add_mods(MOD_LSFT); + } } - } - //Checking all other non-backspace keys to clear the backspace buffer. This is to prevent the bug of deleting N chars sometime after using a macro - if (record->event.pressed && (keycode != KC_BSPACE && keycode != XXXXXXX)) { - char_to_del = 1; + //Checking all other non-backspace keys to clear the backspace buffer. This is to prevent the bug of deleting N chars sometime after using a macro + switch (keycode) { + case LT(COMBOS,KC_BSPC): + case KC_BSPACE: + case KC_DEL: + case KC_LSFT: + case KC_RSFT: + case XXXXXXX: + break; + default: + char_to_bspace = 1; + char_to_del = 0; + break; + } } switch (keycode) { + case XXXXXXX: + if (record->event.pressed && !layer_state_is(BASE)) { + blink_leds(NUM_SCROLL_LED_ON); + return true; + } + break; case KC_TAB: if (record->event.pressed && is_mac_with_base_layer_off()) { - uint8_t mods = get_mods(); - uint8_t mod_state = mods & MOD_MASK_ALT; - if (get_mods() & mod_state) { - del_mods(mod_state); - add_mods(MOD_LCTL); - mac_alt_tab_on = true; - } - - mod_state = mods & MOD_MASK_CTRL; - if (get_mods() & mod_state && !mac_alt_tab_on) { + uint8_t mod_state = get_mods() & MOD_MASK_CTRL; + if (get_mods() & mod_state && !mac_alt_window_switching_on) { del_mods(mod_state); add_mods(MOD_LGUI); mac_ctrl_on = true; } } + case KC_GRAVE: + if (record->event.pressed && is_mac_with_base_layer_off()) { + uint8_t mod_state = get_mods() & MOD_MASK_ALT; + if (get_mods() & mod_state) { + del_mods(mod_state); + add_mods(MOD_LCTL); + mac_alt_window_switching_on = true; + } + } break; case KC_LSFT: - if (record->event.pressed && is_mac_with_base_layer_off()) { - uint8_t mods = get_mods(); - uint8_t mod_state = mods & MOD_MASK_AG; + if (record->event.pressed && is_mac_with_base_layer_off() && !mac_ctrl_on) { + uint8_t mod_state = get_mods() & MOD_MASK_AG; if (get_mods() & mod_state) { del_mods(mod_state); add_mods(MOD_LGUI); mac_gui_on = true; - SEND_STRING(SS_TAP(X_SPACE)); + send_string(lang_switch_combo); return false; } else { return true; @@ -110,27 +123,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { /* && !mac_ctrl_on/!mac_alt_tab_on are required since setting the state while holding the key changes the modifier from OS's perspective. As a result, just the pressed key cannot be the single source of truth to determine which state we're in, and a separate bool is required */ - uint8_t mods = get_mods(); - uint8_t mod_state = mods & MOD_MASK_ALT; + uint8_t alt_state = get_mods() & MOD_MASK_ALT; + uint8_t ctrl_state = get_mods() & MOD_MASK_CTRL; + //Allows Ctrl <-/-> on Mac if Ctrl Tab is already pressed - if (get_mods() & mod_state && mac_alt_tab_on && !mac_ctrl_on) { - del_mods(mod_state); + if (get_mods() & alt_state && mac_alt_window_switching_on && !mac_ctrl_on) { + del_mods(alt_state); add_mods(MOD_LCTL); } - mod_state = mods & MOD_MASK_CTRL; - if (get_mods() & mod_state && !mac_alt_tab_on) { - del_mods(mod_state); - add_mods(MOD_LALT); - mac_ctrl_on = true; - } - } - break; - case KC_DEL: - if (record->event.pressed && is_mac_with_base_layer_off()) { - uint8_t mod_state = get_mods() & MOD_MASK_CTRL; - if (get_mods() & mod_state) { - del_mods(mod_state); + if (get_mods() & ctrl_state && !mac_alt_window_switching_on && !mac_gui_on) { + del_mods(ctrl_state); add_mods(MOD_LALT); mac_ctrl_on = true; } @@ -138,28 +141,31 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case KC_LALT: if (!record->event.pressed && is_mac_with_base_layer_off()) { - if (mac_alt_tab_on) { + if (mac_alt_window_switching_on) { unregister_mods(MOD_LCTL); - mac_alt_tab_on = false; + mac_alt_window_switching_on = false; return false; } else if (mac_gui_on) { - SEND_STRING(SS_UP(X_LGUI)); + unregister_mods(MOD_LGUI); mac_gui_on = false; return false; } + return true; } break; case KC_RALT: - if (!record->event.pressed && mac_alt_tab_on && is_mac_with_base_layer_off()) { + if (!record->event.pressed && mac_alt_window_switching_on && is_mac_with_base_layer_off()) { unregister_mods(MOD_LCTL); - mac_alt_tab_on = false; + mac_alt_window_switching_on = false; return false; } break; case KC_LCTL: case KC_RCTL: if (!record->event.pressed && mac_ctrl_on && is_mac_with_base_layer_off()) { - SEND_STRING(SS_UP(X_LGUI) SS_UP(X_LALT)); + // Need to remove only previously set mods (e.g. WIN & ALT) to preserve Shift, etc + unregister_mods(MOD_LGUI); + unregister_mods(MOD_LALT); mac_ctrl_on = false; return false; } @@ -177,67 +183,134 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; } break; + case KC_DEL: case KC_BSPC: if (record->event.pressed) { - if (char_to_del > 1) { - layer_off(GIT_C); - layer_off(GIT_S); - backspace_n_times(char_to_del); - char_to_del = 1; - return false; - } - - if (is_mac_with_base_layer_off()) { - uint8_t mod_state = get_mods() & MOD_MASK_CTRL; - if (get_mods() & mod_state) { - del_mods(mod_state); - add_mods(MOD_LALT); - mac_ctrl_on = true; + return handle_del_bspace(); + } + break; + case LT(COMBOS, KC_BSPC): + if (record->event.pressed && record->tap.count == 1) { + return handle_del_bspace(); + } + break; + case LT(NAV,KC_APP): + if (!record->event.pressed && !is_win) { + mac_ctrl_on = false; + mac_gui_on = false; + mac_alt_window_switching_on = false; + clear_mods(); + SEND_STRING(SS_TAP(X_LCTL) SS_TAP(X_LGUI) SS_TAP(X_LALT) SS_TAP(X_LSFT)); + return true; + } + break; + /* ------------------------------------------------------------------------- + * CAPS WORD + * ------------------------------------------------------------------------ */ + case KC_CAPS: + if (record->event.pressed && !layer_state_is(BASE)) { + if (get_mods() & MOD_MASK_SHIFT) { + full_caps_mode = true; + led_show_variable_status(full_caps_mode); + if (hw_caps_on) { + SEND_STRING(SS_TAP(X_CAPS)); } + } else if (hw_caps_on) { + full_caps_mode = false; } } break; - + // case KC_SPACE: + case LT(MEDIA,KC_SPC): + case LT(NAV,KC_SPC): + if (record->event.pressed && caps_word_on() && !layer_state_is(BASE) && record->tap.count == 1) { + SEND_STRING(SS_TAP(X_CAPS)); + } + break; + case KC_MINS: + if (record->event.pressed && caps_word_on() && !layer_state_is(BASE)) { + SEND_STRING("_"); + return false; + } + break; /* ------------------------------------------------------------------------- * CUSTOM MACROS * ------------------------------------------------------------------------ */ + case CTRL_CTV: if (record->event.pressed) { - if ( get_mods() & MOD_MASK_SHIFT ) { - clear_mods(); - SEND_STRING(SS_LCTL("ctv")); - } else { - SEND_STRING(SS_LCTL("ctv") SS_TAP(X_ENTER)); + bool shifted = get_mods() & MOD_MASK_SHIFT; + clear_mods(); + + SEND_STRING(SS_LCTL("c")); + wait_ms(COPY_DELAY); + SEND_STRING(SS_LCTL("tv")); + + if (!shifted) { + SEND_STRING(SS_TAP(X_ENTER)); } } break; + case BEAT_BROWSER: + if (record->event.pressed) { + SEND_STRING(SS_LCTL("c")); + wait_ms(COPY_DELAY); + SEND_STRING(SS_LGUI("1") SS_LCTL("tv") SS_TAP(X_ENTER)); + } + break; case CTRL_LCTV: if (record->event.pressed) { - if ( get_mods() & MOD_MASK_SHIFT ) { + if (get_mods() & MOD_MASK_SHIFT) { //Firefox clear_mods(); - SEND_STRING(SS_LCTL("lcP")); - wait_ms(200); + SEND_STRING(SS_LCTL("lc")); + wait_ms(COPY_DELAY); + SEND_STRING(SS_LCTL("P")); + wait_ms(INCOGNITO_DELAY); SEND_STRING(SS_LCTL("v") SS_TAP(X_ENTER)); - } else if ( get_mods() & MOD_MASK_CTRL ) { + } else if (get_mods() & MOD_MASK_CTRL) { //Chrome clear_mods(); - SEND_STRING(SS_LCTL("lcNv") SS_TAP(X_ENTER)); + SEND_STRING(SS_LCTL("lc")); + wait_ms(COPY_DELAY); + SEND_STRING(SS_LCTL("Nv") SS_TAP(X_ENTER)); } else { - SEND_STRING(SS_LCTL("lctv")); + SEND_STRING(SS_LCTL("lc")); + wait_ms(COPY_DELAY); + SEND_STRING(SS_LCTL("tv")); } } break; case CTRL_CAV: if (record->event.pressed) { SEND_STRING(SS_LCTL("c" SS_TAP(X_TAB))); - wait_ms(50); + wait_ms(COPY_DELAY); SEND_STRING(SS_LCTL("av")); } break; + case NEUTRAL_COPY: + if (record->event.pressed && is_win) { + uint8_t shifted = get_mods() & MOD_MASK_SHIFT; + if (shifted) { + del_mods(shifted); + SEND_STRING(SS_LCTL("z")); + } + SEND_STRING(SS_LCTL("c")); + wait_ms(COPY_DELAY); + SEND_STRING(SS_LGUI("r") SS_LCTL("vac") SS_TAP(X_ESC)); + } + break; case SARCASM: if (record->event.pressed) { + del_mods(MOD_LSFT); sarcasm_on = !sarcasm_on; + led_show_variable_status(sarcasm_on); + } + break; + case LMB_SPAM: + if (record->event.pressed) { + is_lmb_timer_active = ! is_lmb_timer_active; + lmb_timer = timer_read(); } break; @@ -247,14 +320,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case TOG_OS: if (record->event.pressed) { is_win = ! is_win; - led_show_current_os(); + led_show_variable_status(is_win); } break; case CTR_ALT: if (record->event.pressed) { - send_string(key_down[is_win]); + add_mods(OS_MOD_KEYS[is_win]); } else { - send_string(key_up[is_win]); + unregister_mods(OS_MOD_KEYS[is_win]); + } + break; + case CTR_ALT_SHIFT: + if (record->event.pressed) { + add_mods(OS_MOD_KEYS[is_win]); + add_mods(MOD_RSFT); + } else { + unregister_mods(OS_MOD_KEYS[is_win]); + unregister_mods(MOD_RSFT); } break; case OS_CTRL: @@ -298,166 +380,342 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // break; // case : // if (record->event.pressed) { - // send_string_remembering_length("", ""); + // send_shifted_strings("", ""); // } // break; case TILD_BLOCK: if (record->event.pressed) { - SEND_STRING("```" SS_LSFT(SS_TAP(X_ENTER) SS_TAP(X_ENTER)) "```" SS_TAP(X_UP)); - char_to_del = 4; + uint8_t alted = get_mods() & MOD_MASK_ALT; + uint8_t switch_lang_state = get_mods() & MOD_MASK_CTRL; + + if (switch_lang_state) { + del_mods(switch_lang_state); + switch_lang(); + } + + if (alted) { + del_mods(alted); + SEND_STRING(SS_TAP(X_ESC) "```" SS_LSFT(SS_TAP(X_ENTER) SS_TAP(X_ENTER)) "```" SS_TAP(X_UP)); + char_to_bspace = 4; + char_to_del = 4; + } else { + SEND_STRING("`` "); + + uint8_t shifted = get_mods() & MOD_MASK_SHIFT; + del_mods(shifted); + SEND_STRING(SS_TAP(X_LEFT) SS_TAP(X_LEFT)); + add_mods(shifted); + char_to_bspace = 1; + char_to_del = 2; + } + + if (switch_lang_state) { + switch_lang(); + } } break; - case ADMINS: + case ALL_BEST: if (record->event.pressed) { - send_shifted_strings_add("admin", "/aurora/status"); + send_shifted_strings_add("All the best,\nArt", "joms"); } break; - case PRESCRIPTION: + case AT_EMAIL: if (record->event.pressed) { - SEND_STRING("55\t12122019\t"); - char_to_del = 8; + send_string_remembering_length("@gmail.com"); + } + break; + case BRACES: + if (record->event.pressed) { + uint8_t shifted = get_mods() & MOD_MASK_SHIFT; + uint8_t switch_lang_state = get_mods() & MOD_MASK_CTRL; + if (switch_lang_state) { + del_mods(switch_lang_state); + switch_lang(); + } + + add_mods(shifted); + SEND_STRING("[]"); + + del_mods(shifted); + SEND_STRING(SS_TAP(X_LEFT)); + add_mods(shifted); + + if (switch_lang_state) { + switch_lang(); + } + char_to_bspace = 1; + char_to_del = 1; } break; - case FOURS: + case DASHES: if (record->event.pressed) { - SEND_STRING("4444333322221111\t1\t12\t21\t123\n"); - char_to_del = 16; + SEND_STRING("--"); + + uint8_t shifted = get_mods() & MOD_MASK_SHIFT; + del_mods(shifted); + SEND_STRING(" " SS_TAP(X_LEFT) SS_TAP(X_LEFT)); + add_mods(shifted); + char_to_bspace = 1; + char_to_del = 2; + } + break; + case PARENTHS: + if (record->event.pressed) { + clear_mods(); + SEND_STRING("() " SS_TAP(X_LEFT) SS_TAP(X_LEFT)); + char_to_bspace = 1; + char_to_del = 2; + } + break; + case QUOTES: + if (record->event.pressed) { + uint8_t shifted = get_mods() & MOD_MASK_SHIFT; + uint8_t switch_lang_state = get_mods() & MOD_MASK_CTRL; + if (switch_lang_state) { + del_mods(switch_lang_state); + switch_lang(); + } + + add_mods(shifted); + SEND_STRING("''"); + + del_mods(shifted); + wait_ms(LONG_TYPING_INTERVAL); + SEND_STRING(" " SS_TAP(X_LEFT) SS_TAP(X_LEFT)); + add_mods(shifted); + + if (switch_lang_state) { + switch_lang(); + } + char_to_bspace = 1; + char_to_del = 2; + } + break; + case QUOTES_RU: + if (record->event.pressed) { + clear_mods(); + SEND_STRING("@@ "); + wait_ms(LONG_TYPING_INTERVAL); + SEND_STRING(SS_TAP(X_LEFT) SS_TAP(X_LEFT)); + char_to_bspace = 1; + char_to_del = 2; + } + break; + case STARS: + if (record->event.pressed) { + clear_mods(); + SEND_STRING("** " SS_TAP(X_LEFT) SS_TAP(X_LEFT)); + char_to_bspace = 1; + char_to_del = 2; + } + break; + + case ADMINS: + if (record->event.pressed) { + send_string_remembering_length("admin"); } break; - case G_ADD: - if (record->event.pressed) { - send_string_remembering_length("git add "); - } - break; - case G_BRCH: - if (record->event.pressed) { - send_shifted_strings_add("git branch ", "-d "); - } - break; - case G_C: - if (record->event.pressed) { - send_string_remembering_length("git c[Heckout/Ommit]"); - layer_on(GIT_C); - } - break; - case G_CHEC: - if (!record->event.pressed) { - bool shifted = get_mods() & MOD_MASK_SHIFT; - clear_mods(); - - backspace_n_times(15); - SEND_STRING("heckout "); - char_to_del = 13; - if (shifted) { - SEND_STRING("-b "); - char_to_del = 16; - } - layer_off(GIT_C); - } - break; - case G_COMM: - if (!record->event.pressed) { - bool shifted = get_mods() & MOD_MASK_SHIFT; - clear_mods(); - - backspace_n_times(15); - SEND_STRING("ommit -"); - char_to_del = 15; - if (shifted) { - SEND_STRING("a"); - char_to_del = 16; - } - SEND_STRING("m \"\"" SS_TAP(X_LEFT)); - layer_off(GIT_C); - } - break; - case G_DEV: - if (record->event.pressed) { - send_shifted_strings("develop", "master"); - } - break; - case G_DIFF: - if (record->event.pressed) { - send_string_remembering_length("git diff "); - } - break; - case G_FTCH: - if (record->event.pressed) { - send_string_remembering_length("git fetch "); - } - break; - case G_LOG: - if (record->event.pressed) { - send_string_remembering_length("git log "); - } - break; - case G_MERG: - if (record->event.pressed) { - send_string_remembering_length("git merge "); - } - break; - case G_P: - if (record->event.pressed) { - send_shifted_strings_add("git pu", "sh -u "); - } - break; - case G_RST: - if (record->event.pressed) { - send_string_remembering_length("git reset "); - } - break; - case G_S: - if (!record->event.pressed) { - send_string_remembering_length("git s[taSh/How/taTus]"); - layer_on(GIT_S); - } - break; - case G_SHOW: - if (!record->event.pressed) { - backspace_n_times(16); - SEND_STRING("how "); - char_to_del = 9; - layer_off(GIT_S); - } - break; - case G_STSH: - if (!record->event.pressed) { - bool shifted = get_mods() & MOD_MASK_SHIFT; - clear_mods(); + case G_ADD: + if (record->event.pressed) { + send_string_remembering_length("git add "); + } + break; + case G_BRCH: + if (record->event.pressed) { + send_shifted_strings_add("git branch ", "-d "); + } + break; + case G_C: + if (record->event.pressed) { + send_string_remembering_length("git c[Heckout/Ommit]"); + layer_on(GIT_C); + } + break; + case G_CHEC: + if (!record->event.pressed) { + bool shifted = get_mods() & MOD_MASK_SHIFT; + clear_mods(); + + press_n_times(15, KC_BSPACE); + send_string_with_translation("heckout "); + char_to_bspace = 13; + if (shifted) { + send_string_with_translation("-b "); + char_to_bspace = 16; + } + layer_off(GIT_C); + } + break; + case G_COMM: + if (!record->event.pressed) { + bool ctrled = get_mods() & MOD_MASK_CTRL; + bool shifted = get_mods() & MOD_MASK_SHIFT; + clear_mods(); + + press_n_times(15, KC_BSPACE); + send_string_with_translation("ommit "); + char_to_bspace = 11; + layer_off(GIT_C); + + if (ctrled) { + return false; + } + + SEND_STRING("-"); + char_to_bspace = 15; + if (shifted) { + send_string_with_translation("a"); + char_to_bspace = 16; + } + send_string_with_translation("m"); + SEND_STRING(" \"\"" SS_TAP(X_LEFT)); + char_to_del = 1; + } + break; + case G_DEV: + if (record->event.pressed) { + send_shifted_strings("develop", "master"); + } + break; + case G_DIFF: + if (record->event.pressed) { + send_string_remembering_length("git diff "); + } + break; + case G_FTCH: + if (record->event.pressed) { + send_string_remembering_length("git fetch "); + } + break; + case G_LOG: + if (record->event.pressed) { + send_string_remembering_length("git log "); + } + break; + case G_MERG: + if (record->event.pressed) { + send_string_remembering_length("git merge "); + } + break; + case G_PULL: + if (record->event.pressed) { + send_string_remembering_length("git pull "); + } + break; + case G_PUSH: + if (record->event.pressed) { + send_string_remembering_length("git push -u "); + } + break; + case G_R: + if (!record->event.pressed) { + send_string_remembering_length("git re[Set/Vert/Base -i]"); + layer_on(GIT_R); + } + break; + case G_RBASE: + if (!record->event.pressed) { + press_n_times(18, KC_BSPACE); + send_string_with_translation("base -i "); + char_to_bspace = 14; + layer_off(GIT_R); + } + break; + case G_RVERT: + if (!record->event.pressed) { + press_n_times(18, KC_BSPACE); + send_string_with_translation("vert "); + char_to_bspace = 11; + layer_off(GIT_R); + } + break; + case G_RST: + if (!record->event.pressed) { + bool shifted = get_mods() & MOD_MASK_SHIFT; + clear_mods(); - backspace_n_times(16); - SEND_STRING("tash "); - char_to_del = 10; + press_n_times(18, KC_BSPACE); + send_string_with_translation("set "); + char_to_bspace = 10; - if (shifted) { + if (shifted) { + send_string_with_translation("--hard "); + char_to_bspace = 17; + } + layer_off(GIT_R); + } + break; + case G_S: + if (!record->event.pressed) { + send_string_remembering_length("git s[taSh/How/taTus]"); + layer_on(GIT_S); + } + break; + case G_SHOW: + if (!record->event.pressed) { + press_n_times(16, KC_BSPACE); + send_string_with_translation("how "); + char_to_bspace = 9; + layer_off(GIT_S); + } + break; + case G_STSH: + if (!record->event.pressed) { + bool shifted = get_mods() & MOD_MASK_SHIFT; clear_mods(); - SEND_STRING("apply "); - char_to_del = 16; + press_n_times(16, KC_BSPACE); + send_string_with_translation("tash "); + char_to_bspace = 10; + + if (shifted) { + clear_mods(); + send_string_with_translation("apply "); + + char_to_bspace = 16; + } + + layer_off(GIT_S); } + break; + case G_STAT: + if (!record->event.pressed) { + press_n_times(16, KC_BSPACE); + send_string_with_translation("tatus "); + char_to_bspace = 11; + layer_off(GIT_S); + } + break; - layer_off(GIT_S); - } - break; - case G_STAT: - if (!record->event.pressed) { - backspace_n_times(16); - SEND_STRING("tatus "); - char_to_del = 11; - layer_off(GIT_S); - } - break; + case K_CUST1 ... K_CUST3: // custom strings not stored in source control + if (!record->event.pressed) { + send_string_remembering_length(custom[keycode - K_CUST1]); + blink_leds(NUM_SCROLL_LED_ON); + } + break; + case K_SECR1 ... K_SECR4: // Secrets! Externally defined strings, not stored in repo + if (!record->event.pressed) { + send_string_remembering_length(secrets[keycode - K_SECR1]); + blink_leds(NUM_SCROLL_LED_ON); + } + break; - case CTL_ALT_START ... CTL_ALT_END: - if (record->event.pressed) { - if (is_win) { - tap_code16(LCTL(keycode - CTL_ALT_START)); + case CTL_ALT_START ... CTL_ALT_END: + if (record->event.pressed) { + if (is_win) { + register_code16(LCTL(keycode - CTL_ALT_START)); + } else { + register_code16(LALT(keycode - CTL_ALT_START)); + } } else { - tap_code16(LALT(keycode - CTL_ALT_START)); + if (is_win) { + unregister_code16(LCTL(keycode - CTL_ALT_START)); + } else { + unregister_code16(LALT(keycode - CTL_ALT_START)); + } } - } - break; + break; } return process_record_keymap(keycode, record); diff --git a/users/art/art.h b/users/art/art.h index 58b005b933..71af966bef 100644 --- a/users/art/art.h +++ b/users/art/art.h @@ -1,18 +1,30 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #include QMK_KEYBOARD_H #define CTL_ALT(kc) (CTL_ALT_START + ((kc) & 0xff)) extern bool is_win; +#define TYPING_INTERVAL 20 +#define LONG_TYPING_INTERVAL 50 enum layer_names { +#if SPLIT75_SETUP_FOR_PUBLIC_USE_BY_DEFAULT && defined(KEYBOARD_wheatfield_split75) // defined by "KEYBOARD" followed by folder structure + BASE, QWERTY, - WORKMAN, - BASE, //only specific for split75 -#if defined(KEYBOARD_wheatfield_split75) - QWERTY_MOD, +#else + QWERTY, + BASE, +#endif + + WORKMAN, +#if defined(KEYBOARD_mt_split75) + CONFIG, LAYOUT_CHG, -#elif defined(KEYBOARD_ergodone) + QWERTY_MOD, +#elif defined(KEYBOARD_ktec_ergodone) FKEYS, CTRL_NAV, SHIFT_NAV, @@ -20,12 +32,12 @@ enum layer_names { MEDIA, COMBOS, - STRINGS, - CONFIG, + //STRINGS, NAV, NUMPAD, GIT, GIT_C, + GIT_R, GIT_S }; @@ -33,35 +45,61 @@ enum custom_keycodes_art { CTRL_CTV = SAFE_RANGE, CTRL_LCTV, CTRL_CAV, + BEAT_BROWSER, + NEUTRAL_COPY, SARCASM, + LMB_SPAM, TOG_OS, CTR_ALT, + CTR_ALT_SHIFT, OS_CTRL, OS_WIN, TILD_BLOCK, + ALL_BEST, + AT_EMAIL, + BRACES, + DASHES, + PARENTHS, + STARS, + QUOTES, + QUOTES_RU, + ADMINS, PRESCRIPTION, FOURS, - + G_ADD, G_BRCH, G_C, - G_CHEC, + G_CHEC, G_COMM, G_DEV, G_DIFF, G_FTCH, G_LOG, G_MERG, - G_P, + G_PULL, + G_PUSH, + G_R, + G_RBASE, + G_RVERT, G_RST, G_S, G_STAT, G_STSH, G_SHOW, + K_CUST1, + K_CUST2, + K_CUST3, + + K_SECR1, + K_SECR2, + K_SECR3, + K_SECR4, + CTL_ALT_START, CTL_ALT_END = CTL_ALT_START + 0xff, diff --git a/users/art/art_user_config.h.example b/users/art/art_user_config.h.example new file mode 100644 index 0000000000..b523867259 --- /dev/null +++ b/users/art/art_user_config.h.example @@ -0,0 +1,7 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + +#define SPLIT75_SETUP_FOR_PUBLIC_USE_BY_DEFAULT true +#define WORKMAN_TO_QWERTY_HW_MAPPING false + +#define lang_switch_combo SS_LGUI(SS_TAP(X_Z))
\ No newline at end of file diff --git a/users/art/config.h b/users/art/config.h index 72419ff376..78c7851c65 100644 --- a/users/art/config.h +++ b/users/art/config.h @@ -1,4 +1,14 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #undef TAPPING_TOGGLE #define TAPPING_TOGGLE 2 + +#define COMBO_SHOULD_TRIGGER + +// saving space +#define LAYER_STATE_16BIT // remove if using more than 16 layers +#define NO_ACTION_ONESHOT +#define NO_MUSIC_MODE
\ No newline at end of file diff --git a/users/art/custom_definitions.h.example b/users/art/custom_definitions.h.example new file mode 100644 index 0000000000..b15d3d5e6d --- /dev/null +++ b/users/art/custom_definitions.h.example @@ -0,0 +1,8 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + +static char * custom[] = { + "", + "", + "" +};
\ No newline at end of file diff --git a/users/art/funcs/led_funcs.c b/users/art/funcs/led_funcs.c new file mode 100644 index 0000000000..873836d368 --- /dev/null +++ b/users/art/funcs/led_funcs.c @@ -0,0 +1,55 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "led_funcs.h" + +bool hw_caps_on; + +__attribute__ ((weak)) void num_led_on(void) {} +__attribute__ ((weak)) void num_led_off(void) {} +__attribute__ ((weak)) void caps_led_on(void) {} +__attribute__ ((weak)) void caps_led_off(void) {} +__attribute__ ((weak)) void scroll_led_on(void) {} +__attribute__ ((weak)) void scroll_led_off(void) {} + +void toggle_leds(int leds) { + if (NUM_LED_ON & leds) { + num_led_on(); + } else { + num_led_off(); + } + if (SCROLL_LED_ON & leds) { + scroll_led_on(); + } else { + scroll_led_off(); + } +} + +bool led_update_user(led_t led_state) { + // only use caps LED - ignore Num & Scroll + if (led_state.caps_lock) { + caps_led_on(); + } else { + caps_led_off(); + } + + hw_caps_on = led_state.caps_lock; + return false; // 'false' prevents led_update_kb from firing +} + +void blink_leds(int leds) { + for (int i = 0; i < 3; i++) { + toggle_leds(leds); + wait_ms(BLINKING_INTERVAL); + toggle_leds(ALL_OFF); + wait_ms(BLINKING_INTERVAL); + } +} + +void led_show_variable_status(bool value) { + if (value) { + blink_leds(NUM_LED_ON); + } else { + blink_leds(SCROLL_LED_ON); + } +}
\ No newline at end of file diff --git a/users/art/funcs/led_funcs.h b/users/art/funcs/led_funcs.h new file mode 100644 index 0000000000..65d2b7c155 --- /dev/null +++ b/users/art/funcs/led_funcs.h @@ -0,0 +1,17 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once +#include QMK_KEYBOARD_H + +#define NUM_LED_ON 4 +#define SCROLL_LED_ON 1 +#define NUM_SCROLL_LED_ON 5 +#define ALL_OFF 0 + +#define BLINKING_INTERVAL 25 + +void toggle_leds(int leds); +bool led_update_user(led_t led_state); +void blink_leds(int leds); +void led_show_variable_status(bool value);
\ No newline at end of file diff --git a/users/art/funcs/string_funcs.c b/users/art/funcs/string_funcs.c new file mode 100644 index 0000000000..d3a177a1b1 --- /dev/null +++ b/users/art/funcs/string_funcs.c @@ -0,0 +1,309 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "art.h" +#include "string_funcs.h" +#include "string.h" + +bool mac_ctrl_on; + +int char_to_bspace; +int char_to_del; + +enum combo_events { + HOMEROW_UP, + HOMEROW_LEFT, + HOMEROW_RIGHT, + HOMEROW_DOWN, + HOMEROW_PREV_WORD, + HOMEROW_NEXT_WORD, + HOMEROW_HOME, + HOMEROW_END, + + ED_F1, + ED_F2, + ED_F3, + ED_F4, + ED_F5, + ED_F6, + ED_F7, + ED_F8, + ED_F9, + ED_F10, + ED_F11, + ED_F12, + ED_PSCREEN, + + ED_ENTER, + + ED_CS_ENTER, + BSPC_LSFT_CLEAR, + COMBO_LENGTH +}; +uint16_t COMBO_LEN = COMBO_LENGTH; // do not remove - needed for combos to work + +const uint16_t PROGMEM combo_up[] = {KC_W, KC_R, COMBO_END}; +const uint16_t PROGMEM combo_left[] = {KC_S, KC_E, COMBO_END}; +const uint16_t PROGMEM combo_right[] = {KC_F, KC_E, COMBO_END}; +const uint16_t PROGMEM combo_down[] = {KC_S, KC_F, COMBO_END}; +const uint16_t PROGMEM combo_prev_word[] = {KC_S, KC_LCTRL, COMBO_END}; +const uint16_t PROGMEM combo_next_word[] = {KC_F, KC_LCTRL, COMBO_END}; +const uint16_t PROGMEM combo_end[] = {KC_W, KC_E, COMBO_END}; +const uint16_t PROGMEM combo_home[] = {KC_E, KC_R, COMBO_END}; + +const uint16_t PROGMEM combo_enter[] = {KC_BSPC, KC_INS, COMBO_END}; + +const uint16_t PROGMEM combo_f1[] = {KC_1, KC_Q, COMBO_END}; +const uint16_t PROGMEM combo_f2[] = {KC_2, KC_W, COMBO_END}; +const uint16_t PROGMEM combo_f3[] = {KC_3, KC_E, COMBO_END}; +const uint16_t PROGMEM combo_f4[] = {KC_4, KC_R, COMBO_END}; +const uint16_t PROGMEM combo_f5[] = {KC_5, KC_T, COMBO_END}; +const uint16_t PROGMEM combo_f6[] = {KC_6, KC_Y, COMBO_END}; +const uint16_t PROGMEM combo_f7[] = {KC_7, KC_U, COMBO_END}; +const uint16_t PROGMEM combo_f8[] = {KC_8, KC_I, COMBO_END}; +const uint16_t PROGMEM combo_f9[] = {KC_9, KC_O, COMBO_END}; +const uint16_t PROGMEM combo_f10[] = {KC_0, KC_P, COMBO_END}; +const uint16_t PROGMEM combo_f11[] = {LT(GIT,KC_SLSH), KC_RSFT, COMBO_END}; +const uint16_t PROGMEM combo_f12[] = {KC_RALT, KC_RCTRL, COMBO_END}; +const uint16_t PROGMEM combo_pscreen[] = {TO(WORKMAN), KC_RALT, COMBO_END}; + +const uint16_t PROGMEM done_sm[] = {KC_LEFT, KC_RIGHT, COMBO_END}; +const uint16_t PROGMEM clear_line_combo[] = {KC_BSPC, KC_LSFT, COMBO_END}; + +combo_t key_combos[] = { + [HOMEROW_UP] = COMBO(combo_up, KC_UP), + [HOMEROW_LEFT] = COMBO(combo_left, KC_LEFT), + [HOMEROW_RIGHT] = COMBO(combo_right, KC_RIGHT), + [HOMEROW_DOWN] = COMBO(combo_down, KC_DOWN), + [HOMEROW_PREV_WORD] = COMBO_ACTION(combo_prev_word), + [HOMEROW_NEXT_WORD] = COMBO_ACTION(combo_next_word), + [HOMEROW_HOME] = COMBO(combo_end, KC_HOME), + [HOMEROW_END] = COMBO(combo_home, KC_END), + + #if defined(KEYBOARD_ktec_ergodone) + [ED_ENTER] = COMBO(combo_enter, KC_ENTER), + + [ED_F1] = COMBO(combo_f1, KC_F1), + [ED_F2] = COMBO(combo_f2, KC_F2), + [ED_F3] = COMBO(combo_f3, KC_F3), + [ED_F4] = COMBO(combo_f4, KC_F4), + [ED_F5] = COMBO(combo_f5, KC_F5), + [ED_F6] = COMBO(combo_f6, KC_F6), + [ED_F7] = COMBO(combo_f7, KC_F7), + [ED_F8] = COMBO(combo_f8, KC_F8), + [ED_F9] = COMBO(combo_f9, KC_F9), + [ED_F10] = COMBO(combo_f10, KC_F10), + [ED_F11] = COMBO(combo_f11, KC_F11), + [ED_F12] = COMBO(combo_f12, KC_F12), + [ED_PSCREEN] = COMBO(combo_pscreen, KC_PSCREEN), + + [ED_CS_ENTER] = COMBO_ACTION(done_sm), + #endif + + [BSPC_LSFT_CLEAR] = COMBO_ACTION(clear_line_combo), +}; + +void process_combo_event(uint16_t combo_index, bool pressed) { + switch(combo_index) { + case HOMEROW_PREV_WORD: + if (pressed) { + if (is_win) { + tap_code16(C(KC_LEFT)); + } else { + tap_code16(A(KC_LEFT)); + } + } + break; + case HOMEROW_NEXT_WORD: + if (pressed) { + if (is_win) { + tap_code16(C(KC_RIGHT)); + } else { + tap_code16(A(KC_RIGHT)); + } + } + break; + case BSPC_LSFT_CLEAR: + if (pressed) { + tap_code16(KC_END); + tap_code16(S(KC_HOME)); + tap_code16(KC_BSPC); + } + break; + case ED_CS_ENTER: + if (pressed) { + tap_code16(C(S(KC_ENTER))); + } + break; + } +} + +bool combo_should_trigger(uint16_t combo_index, combo_t *combo, uint16_t keycode, keyrecord_t *record) { + return !layer_state_is(BASE); +} + +bool is_mac_with_base_layer_off(void) { + return !is_win && !layer_state_is(BASE); +} + +void switch_lang(void) { + if (is_win) { + SEND_STRING(SS_LALT(SS_TAP(X_LSFT))); + } else { + send_string(lang_switch_combo); + wait_ms(10); + } +} + +void press_n_times(int times, uint16_t key) { + for (int i=0; i<times; i++) { + // wait_ms(TYPING_INTERVAL); + tap_code16(key); + } +} + + +bool handle_del_bspace(void) { + if (char_to_bspace > 1 || char_to_del > 0) { + layer_off(GIT_C); + layer_off(GIT_R); + layer_off(GIT_S); + + press_n_times(char_to_bspace, KC_BSPACE); + char_to_bspace = 1; + press_n_times(char_to_del, KC_DEL); + char_to_del = 0; + + return false; + } + + if (is_mac_with_base_layer_off()) { + uint8_t mod_state = get_mods() & MOD_MASK_CTRL; + if (get_mods() & mod_state) { + del_mods(mod_state); + add_mods(MOD_LALT); + mac_ctrl_on = true; + } + } + return true; +} + +void send_string_with_translation(char *string) { + #if WORKMAN_TO_QWERTY_HW_MAPPING + if (layer_state_is(WORKMAN)) { + int isUpperCase = 0; + for (int i = 0; i < strlen(string); i++) { + char toPrint = string[i]; + if (isupper(toPrint)) { + if (toPrint == 'P') { + SEND_STRING(":"); + continue; + } + + isUpperCase = 1; + toPrint = tolower(toPrint); + } + switch (toPrint) { + case ':': + toPrint = 'I'; + break; + + case 'w': + toPrint = 'd'; + break; + case 'e': + toPrint = 'r'; + break; + case 'r': + toPrint = 'w'; + break; + case 't': + toPrint = 'b'; + break; + case 'y': + toPrint = 'j'; + break; + case 'u': + toPrint = 'f'; + break; + case 'i': + toPrint = 'u'; + break; + case 'o': + toPrint = 'p'; + break; + case 'p': + toPrint = ';'; + break; + + case 'd': + toPrint = 'h'; + break; + case 'f': + toPrint = 't'; + break; + case 'h': + toPrint = 'y'; + break; + case 'j': + toPrint = 'n'; + break; + case 'k': + toPrint = 'e'; + break; + case 'l': + toPrint = 'o'; + break; + case ';': + toPrint = 'i'; + break; + + case 'b': + toPrint = 'm'; + break; + case 'n': + toPrint = 'k'; + break; + case 'm': + toPrint = 'l'; + break; + } + if (isUpperCase) { + isUpperCase = 0; + toPrint = toupper(toPrint); + } + send_char(toPrint); + } + } else { + send_string(string); + } + #else + send_string(string); + #endif +} + +void send_string_remembering_length(char *string) { + send_string_with_translation(string); + char_to_bspace = strlen(string); +} + +void send_shifted_strings(char *string1, char *string2) { + if (get_mods() & MOD_MASK_SHIFT) { + clear_mods(); + send_string_remembering_length(string2); + } else { + send_string_remembering_length(string1); + } +} + +void send_shifted_strings_add(char *string1, char *string2) { + bool shifted = get_mods() & MOD_MASK_SHIFT; + clear_mods(); + + send_string_remembering_length(string1); + + if (shifted) { + send_string(string2); + char_to_bspace = strlen(string1) + strlen(string2); + } +}
\ No newline at end of file diff --git a/users/art/funcs/string_funcs.h b/users/art/funcs/string_funcs.h new file mode 100644 index 0000000000..6d0c424245 --- /dev/null +++ b/users/art/funcs/string_funcs.h @@ -0,0 +1,14 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once +#include QMK_KEYBOARD_H + +bool is_mac_with_base_layer_off(void); +void switch_lang(void); +void press_n_times(int times, uint16_t key); +bool handle_del_bspace(void); +void send_string_with_translation(char *string); +void send_string_remembering_length(char *string); +void send_shifted_strings(char *string1, char *string2); +void send_shifted_strings_add(char *string1, char *string2);
\ No newline at end of file diff --git a/users/art/rules.mk b/users/art/rules.mk index 2b701eb949..9bf4d167fc 100644 --- a/users/art/rules.mk +++ b/users/art/rules.mk @@ -1 +1,15 @@ -SRC += art.c
\ No newline at end of file +SRC += art.c +SRC += funcs/led_funcs.c +SRC += funcs/string_funcs.c + +COMBO_ENABLE = yes + +# saving space +COMMAND_ENABLE = no +CONSOLE_ENABLE = no +GRAVE_ESC_ENABLE = no +LTO_ENABLE = yes +MAGIC_ENABLE = no +# MOUSEKEY_ENABLE = no +MUSIC_ENABLE = no +SPACE_CADET_ENABLE = no
\ No newline at end of file diff --git a/users/art/secr.h.example b/users/art/secr.h.example new file mode 100644 index 0000000000..468943fad2 --- /dev/null +++ b/users/art/secr.h.example @@ -0,0 +1,9 @@ +// Copyright 2022 Artjoms Rizihs (@artjomsR) +// SPDX-License-Identifier: GPL-2.0-or-later + +static char * secrets[] = { + "", + "", + "", + "" +};
\ No newline at end of file |