diff options
| author | csc027 <csc_dev@protonmail.com> | 2020-01-13 17:41:13 +0000 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2020-01-13 09:41:13 -0800 |
| commit | 1b8cb95f2e56acf09bb66e779b800ae14aa074e5 (patch) | |
| tree | 2ffc478e6fa0f3a79290126588853f9d9cab1996 | |
| parent | 390a4fdc9d9a7c65c202d69eb40fbfcfcb070bb0 (diff) | |
| download | qmk_firmware-1b8cb95f2e56acf09bb66e779b800ae14aa074e5.tar.gz qmk_firmware-1b8cb95f2e56acf09bb66e779b800ae14aa074e5.zip | |
[Keymap] csc027/macro-sync-keymap (#7873)
* Basic functionality to synchronize the strings and enums using C preprocessor macros.
* Updated all the custom convenience macros to work.
* Removed some duplicate update_tri_layer calls.
* Simplified the convenience accelerator macros for synchronizing enums and strings by removing the short enum names.
* Updated the CUSTOM_MACROS macro to use SS_LCTL instead of SS_LCTRL.
* Fixed a bug where the right side of the convenience layer in the Iris keymap was incorrectly listed twice.
* Removed the tenkey from the convenience layer. Added Windows 10 virtual desktop shortcuts to the convenience layer.
* Fixed a bug where the macro range was not set correctly.
* Added sigil values for the keycode enum so that additions to the sync macros will not require changes to the process_record_user ranges.
* Hacked send_string_P to work with ChibiOS boards.
* Switched to using I2C for the Iris keyboard.
* Finished a comment.
* Updated comments to explain that for non-AVR MCUs, the PROGMEM macro doesn't do anything.
* Updated the synchronization macros to use the more descriptive "NAME" instead of "CALL". Moved the Control-Alt-Delete chord macro to the synchronization macro.
* Simplified the custom macros by consolidating the macros into a context change macro instead of using alt-tab and minimize macros.
* Fixed a formatting issue where several tabs were used instead of 4 spaces.
* Added more comments to explain the synchronization macros.
* Simplified the PARAMS macro, since any parameters could be passed with a space by the declarer instead.
* Consolidated the synchronization macros into a single list. Simplified the synchronization mechanism.
* Removed the overloading macro, since it is no longer needed.
* Updated the convenience layer comments to reflect the changes made.
* Renamed the git_macros pointer table to custom_macros, since it no longer solely consists of git macros.
* Clarified that the send_string_P function's use of pgm_read_byte is different for AVR and non-AVR compilation targets.
| -rw-r--r-- | keyboards/keebio/iris/keymaps/csc027/config.h | 2 | ||||
| -rw-r--r-- | keyboards/keebio/iris/keymaps/csc027/keymap.c | 8 | ||||
| -rw-r--r-- | users/csc027/csc027.c | 60 | ||||
| -rw-r--r-- | users/csc027/csc027.h | 32 | ||||
| -rw-r--r-- | users/csc027/defines.h | 157 |
5 files changed, 141 insertions, 118 deletions
diff --git a/keyboards/keebio/iris/keymaps/csc027/config.h b/keyboards/keebio/iris/keymaps/csc027/config.h index 01bb31a6e..5d201a6f1 100644 --- a/keyboards/keebio/iris/keymaps/csc027/config.h +++ b/keyboards/keebio/iris/keymaps/csc027/config.h | |||
| @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 17 | 17 | ||
| 18 | #pragma once | 18 | #pragma once |
| 19 | 19 | ||
| 20 | // #define USE_I2C | 20 | #define USE_I2C |
| 21 | #define EE_HANDS | 21 | #define EE_HANDS |
| 22 | 22 | ||
| 23 | #undef RGBLED_NUM | 23 | #undef RGBLED_NUM |
diff --git a/keyboards/keebio/iris/keymaps/csc027/keymap.c b/keyboards/keebio/iris/keymaps/csc027/keymap.c index 398947555..82a077391 100644 --- a/keyboards/keebio/iris/keymaps/csc027/keymap.c +++ b/keyboards/keebio/iris/keymaps/csc027/keymap.c | |||
| @@ -45,10 +45,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 45 | ), | 45 | ), |
| 46 | 46 | ||
| 47 | [_CN] = LAYOUT_wrapper( | 47 | [_CN] = LAYOUT_wrapper( |
| 48 | ___________________CONVENIENCE_L1__________________, ___________________CONVENIENCE_L1__________________, | 48 | ___________________CONVENIENCE_L1__________________, ___________________CONVENIENCE_R1__________________, |
| 49 | ___________________CONVENIENCE_L2__________________, ___________________CONVENIENCE_L2__________________, | 49 | ___________________CONVENIENCE_L2__________________, ___________________CONVENIENCE_R2__________________, |
| 50 | ___________________CONVENIENCE_L3__________________, ___________________CONVENIENCE_L3__________________, | 50 | ___________________CONVENIENCE_L3__________________, ___________________CONVENIENCE_R3__________________, |
| 51 | ___________________CONVENIENCE_L4__________________, _______, _______, ___________________CONVENIENCE_L4__________________, | 51 | ___________________CONVENIENCE_L4__________________, _______, _______, ___________________CONVENIENCE_R4__________________, |
| 52 | _______, _______, _______, _______, _______, _______ | 52 | _______, _______, _______, _______, _______, _______ |
| 53 | ), | 53 | ), |
| 54 | 54 | ||
diff --git a/users/csc027/csc027.c b/users/csc027/csc027.c index 106be9b69..de1bad6f2 100644 --- a/users/csc027/csc027.c +++ b/users/csc027/csc027.c | |||
| @@ -1,32 +1,11 @@ | |||
| 1 | #include "csc027.h" | 1 | #include "csc027.h" |
| 2 | 2 | ||
| 3 | static const char* git_macros[] = { | 3 | // Declare the strings in PROGMEM using the convenience macro |
| 4 | // Make sure that the macro strings match the order they are declared | 4 | CUSTOM_MACROS(CUSTOM_DEF, CUSTOM_MACRO_STRING, SEMI_DELIM); |
| 5 | // in the custom_keycodes enum. | 5 | |
| 6 | "git add ", | 6 | static const char* const custom_macros[] PROGMEM = { |
| 7 | "git branch ", | 7 | // Declare the pointer to the strings in PROGMEM |
| 8 | "git checkout ", | 8 | CUSTOM_MACROS(CUSTOM_VAR, DROP, COMMA_DELIM) |
| 9 | "git cherry-pick ", | ||
| 10 | "git commit -m \"\""SS_TAP(X_LEFT), | ||
| 11 | "git diff ", | ||
| 12 | "git fetch ", | ||
| 13 | "git grep ", | ||
| 14 | "git log --decorate --oneline --graph ", | ||
| 15 | "git init ", | ||
| 16 | "git mv ", | ||
| 17 | "git merge ", | ||
| 18 | "git push ", | ||
| 19 | "git pull ", | ||
| 20 | "git rebase ", | ||
| 21 | "git remote ", | ||
| 22 | "git reset ", | ||
| 23 | "git show ", | ||
| 24 | "git stash ", | ||
| 25 | "git status ", | ||
| 26 | "git tag ", | ||
| 27 | SS_LCTL(SS_LALT(SS_TAP(X_HOME)))"\t ", | ||
| 28 | SS_LCTL(SS_LALT(SS_TAP(X_HOME)))"\t\t\t ", | ||
| 29 | SS_LCTL(SS_LALT(SS_TAP(X_HOME)))SS_LALT("\t") | ||
| 30 | }; | 9 | }; |
| 31 | 10 | ||
| 32 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 11 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| @@ -34,26 +13,37 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 34 | case LOWER: | 13 | case LOWER: |
| 35 | if(record->event.pressed) { | 14 | if(record->event.pressed) { |
| 36 | layer_on(_LW); | 15 | layer_on(_LW); |
| 37 | update_tri_layer(_LW, _RS, _MS); | ||
| 38 | } else { | 16 | } else { |
| 39 | layer_off(_LW); | 17 | layer_off(_LW); |
| 40 | update_tri_layer(_LW, _RS, _MS); | ||
| 41 | } | 18 | } |
| 19 | update_tri_layer(_LW, _RS, _MS); | ||
| 42 | return false; | 20 | return false; |
| 43 | case RAISE: | 21 | case RAISE: |
| 44 | if(record->event.pressed) { | 22 | if(record->event.pressed) { |
| 45 | layer_on(_RS); | 23 | layer_on(_RS); |
| 46 | update_tri_layer(_LW, _RS, _MS); | ||
| 47 | } else { | 24 | } else { |
| 48 | layer_off(_RS); | 25 | layer_off(_RS); |
| 49 | update_tri_layer(_LW, _RS, _MS); | ||
| 50 | } | 26 | } |
| 27 | update_tri_layer(_LW, _RS, _MS); | ||
| 51 | return false; | 28 | return false; |
| 52 | case GIT_ADD...MC_ATRD: | 29 | case (MC_first + 1)...(MC_last - 1): |
| 53 | if(record->event.pressed) { | 30 | if(record->event.pressed) { |
| 54 | // The calculation here is to make sure that the custom keycode | 31 | send_string_P( |
| 55 | // aligns with the git_macros array. | 32 | #if defined(__AVR__) |
| 56 | send_string(git_macros[keycode - GIT_ADD]); | 33 | // The accessor here first reads from the pointer array that is located |
| 34 | // in PROGMEM. The pointer is taken and passed to the send_string_P | ||
| 35 | // function, which is aware of the difference between RAM and PROGMEM | ||
| 36 | // pointers. | ||
| 37 | (char*)pgm_read_word(&custom_macros[keycode - MC_first - 1]) | ||
| 38 | #else | ||
| 39 | // For non-AVR MCUs, the PROGMEM macro is defined as nothing. So, the strings are | ||
| 40 | // declared in RAM instead of flash. The send_string_P function, when compiled for | ||
| 41 | // non-AVR targets, uses a different definition of pgm_read_byte internally. This | ||
| 42 | // definition uses RAM pointers instead. This is why the raw pointer is passed for | ||
| 43 | // non-AVR MCUs. | ||
| 44 | custom_macros[keycode - MC_first - 1] | ||
| 45 | #endif | ||
| 46 | ); | ||
| 57 | return true; | 47 | return true; |
| 58 | } | 48 | } |
| 59 | return false; | 49 | return false; |
diff --git a/users/csc027/csc027.h b/users/csc027/csc027.h index 2a4c8a8a6..96bf7dc0e 100644 --- a/users/csc027/csc027.h +++ b/users/csc027/csc027.h | |||
| @@ -8,33 +8,13 @@ enum custom_keycodes { | |||
| 8 | LOWER = SAFE_RANGE, | 8 | LOWER = SAFE_RANGE, |
| 9 | RAISE, | 9 | RAISE, |
| 10 | 10 | ||
| 11 | // Git Keycodes | ||
| 12 | GIT_ADD, // Add | ||
| 13 | GIT_BRC, // Branch | ||
| 14 | GIT_CHK, // Checkout | ||
| 15 | GIT_CHR, // Cherry-Pick | ||
| 16 | GIT_CMT, // Commit | ||
| 17 | GIT_DIF, // Diff | ||
| 18 | GIT_FTC, // Fetch | ||
| 19 | GIT_GRP, // Grep | ||
| 20 | GIT_LOG, // Log | ||
| 21 | GIT_INT, // Init | ||
| 22 | GIT_MRG, // Merge | ||
| 23 | GIT_MOV, // Move (mv) | ||
| 24 | GIT_PSH, // Push | ||
| 25 | GIT_PUL, // Pull | ||
| 26 | GIT_RBS, // Rebase | ||
| 27 | GIT_RMT, // Remote | ||
| 28 | GIT_RST, // Reset | ||
| 29 | GIT_SHW, // Show | ||
| 30 | GIT_STH, // Stash | ||
| 31 | GIT_STS, // Status | ||
| 32 | GIT_TAG, // Tag | ||
| 33 | 11 | ||
| 34 | // Remote Desktop | 12 | MC_first, |
| 35 | MC_MRD7, // Minimize Remote Desktop on Windows 7 | 13 | |
| 36 | MC_MRD8, // Minimize Remote Desktop on Windows 8+ | 14 | // Macro Keycodes |
| 37 | MC_ATRD // Switch windows on local machine from Remote Desktop on Windows | 15 | CUSTOM_MACROS(CUSTOM_ENUM, DROP, COMMA_DELIM), |
| 16 | |||
| 17 | MC_last | ||
| 38 | }; | 18 | }; |
| 39 | 19 | ||
| 40 | enum custom_layers { | 20 | enum custom_layers { |
diff --git a/users/csc027/defines.h b/users/csc027/defines.h index 3eaa95d83..4f52938f1 100644 --- a/users/csc027/defines.h +++ b/users/csc027/defines.h | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | #include "csc027.h" | 2 | #include "csc027.h" |
| 3 | 3 | ||
| 4 | #define MC_LCAD LCA(KC_DEL) // Control-Alt-Delete | ||
| 5 | #define MC_RSFE RSFT_T(KC_ENT) // Right Shift on hold, Enter on tap | 4 | #define MC_RSFE RSFT_T(KC_ENT) // Right Shift on hold, Enter on tap |
| 6 | #define MC_LSEC LSFT_T(KC_ESC) // Left Shift on hold, Escape on tap | 5 | #define MC_LSEC LSFT_T(KC_ESC) // Left Shift on hold, Escape on tap |
| 7 | 6 | ||
| @@ -85,15 +84,15 @@ | |||
| 85 | * `-----------------------------------' `-----------------------------------' | 84 | * `-----------------------------------' `-----------------------------------' |
| 86 | */ | 85 | */ |
| 87 | 86 | ||
| 88 | #define ______________________RAISE_L1_____________________ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC | 87 | #define ______________________RAISE_L1_____________________ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC |
| 89 | #define ______________________RAISE_L2_____________________ _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_CAPS | 88 | #define ______________________RAISE_L2_____________________ _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_CAPS |
| 90 | #define ______________________RAISE_L3_____________________ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 | 89 | #define ______________________RAISE_L3_____________________ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 |
| 91 | #define ______________________RAISE_L4_____________________ _______, _______, _______, _______, _______, _______ | 90 | #define ______________________RAISE_L4_____________________ _______, _______, _______, _______, _______, _______ |
| 92 | 91 | ||
| 93 | #define ______________________RAISE_R1_____________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DELT | 92 | #define ______________________RAISE_R1_____________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DELT |
| 94 | #define ______________________RAISE_R2_____________________ KC_HOME, KC_PGDN, KC_PGUP, KC_END, XXXXXXX, XXXXXXX | 93 | #define ______________________RAISE_R2_____________________ KC_HOME, KC_PGDN, KC_PGUP, KC_END, XXXXXXX, XXXXXXX |
| 95 | #define ______________________RAISE_R3_____________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______ | 94 | #define ______________________RAISE_R3_____________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______ |
| 96 | #define ______________________RAISE_R4_____________________ _______, _______, _______, _______, XXXXXXX, XXXXXXX | 95 | #define ______________________RAISE_R4_____________________ _______, _______, _______, _______, XXXXXXX, XXXXXXX |
| 97 | 96 | ||
| 98 | /* Lower Layer | 97 | /* Lower Layer |
| 99 | * | 98 | * |
| @@ -118,15 +117,15 @@ | |||
| 118 | * `-----------------------------------' `-----------------------------------' | 117 | * `-----------------------------------' `-----------------------------------' |
| 119 | */ | 118 | */ |
| 120 | 119 | ||
| 121 | #define ______________________LOWER_L1_____________________ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5 | 120 | #define ______________________LOWER_L1_____________________ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5 |
| 122 | #define ______________________LOWER_L2_____________________ _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, XXXXXXX | 121 | #define ______________________LOWER_L2_____________________ _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, XXXXXXX |
| 123 | #define ______________________LOWER_L3_____________________ _______, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX | 122 | #define ______________________LOWER_L3_____________________ _______, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX |
| 124 | #define ______________________LOWER_L4_____________________ _______, _______, _______, _______, _______, _______ | 123 | #define ______________________LOWER_L4_____________________ _______, _______, _______, _______, _______, _______ |
| 125 | 124 | ||
| 126 | #define ______________________LOWER_R1_____________________ KC_6, KC_7, KC_8, KC_9, KC_0, KC_DELT | 125 | #define ______________________LOWER_R1_____________________ KC_6, KC_7, KC_8, KC_9, KC_0, KC_DELT |
| 127 | #define ______________________LOWER_R2_____________________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, XXXXXXX | 126 | #define ______________________LOWER_R2_____________________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, XXXXXXX |
| 128 | #define ______________________LOWER_R3_____________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ | 127 | #define ______________________LOWER_R3_____________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ |
| 129 | #define ______________________LOWER_R4_____________________ _______, _______, _______, _______, XXXXXXX, XXXXXXX | 128 | #define ______________________LOWER_R4_____________________ _______, _______, _______, _______, XXXXXXX, XXXXXXX |
| 130 | 129 | ||
| 131 | 130 | ||
| 132 | /* MIT Layout (Mouse) | 131 | /* MIT Layout (Mouse) |
| @@ -144,15 +143,15 @@ | |||
| 144 | * `-----------------------------------' `-----------------------------------' | 143 | * `-----------------------------------' `-----------------------------------' |
| 145 | */ | 144 | */ |
| 146 | 145 | ||
| 147 | #define ______________________MOUSE_L1_____________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX | 146 | #define ______________________MOUSE_L1_____________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX |
| 148 | #define ______________________MOUSE_L2_____________________ _______, XXXXXXX, XXXXXXX, KC_BTN1, KC_BTN2, XXXXXXX | 147 | #define ______________________MOUSE_L2_____________________ _______, XXXXXXX, XXXXXXX, KC_BTN1, KC_BTN2, XXXXXXX |
| 149 | #define ______________________MOUSE_L3_____________________ _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX | 148 | #define ______________________MOUSE_L3_____________________ _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX |
| 150 | #define ______________________MOUSE_L4_____________________ _______, _______, _______, _______, _______, _______ | 149 | #define ______________________MOUSE_L4_____________________ _______, _______, _______, _______, _______, _______ |
| 151 | 150 | ||
| 152 | #define ______________________MOUSE_R1_____________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX | 151 | #define ______________________MOUSE_R1_____________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX |
| 153 | #define ______________________MOUSE_R2_____________________ KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, XXXXXXX, XXXXXXX | 152 | #define ______________________MOUSE_R2_____________________ KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, XXXXXXX, XXXXXXX |
| 154 | #define ______________________MOUSE_R3_____________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ | 153 | #define ______________________MOUSE_R3_____________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ |
| 155 | #define ______________________MOUSE_R4_____________________ _______, _______, _______, _______, XXXXXXX, XXXXXXX | 154 | #define ______________________MOUSE_R4_____________________ _______, _______, _______, _______, XXXXXXX, XXXXXXX |
| 156 | 155 | ||
| 157 | /* MIT Layout (Git) | 156 | /* MIT Layout (Git) |
| 158 | * | 157 | * |
| @@ -169,49 +168,103 @@ | |||
| 169 | * `-----------------------------------' `-----------------------------------' | 168 | * `-----------------------------------' `-----------------------------------' |
| 170 | */ | 169 | */ |
| 171 | 170 | ||
| 172 | #define _______________________GIT_L1______________________ XXXXXXX, GIT_CHR, GIT_SHW, GIT_RBS, GIT_RST, GIT_TAG | 171 | #define _______________________GIT_L1______________________ XXXXXXX, MC_cherrypick, MC_show, MC_rebase, MC_reset, MC_tag |
| 173 | #define _______________________GIT_L2______________________ _______, GIT_ADD, GIT_STS, GIT_DIF, GIT_FTC, GIT_GRP | 172 | #define _______________________GIT_L2______________________ _______, MC_add, MC_status, MC_diff, MC_fetch, MC_grep |
| 174 | #define _______________________GIT_L3______________________ _______, XXXXXXX, XXXXXXX, GIT_CMT, GIT_MOV, GIT_BRC | 173 | #define _______________________GIT_L3______________________ _______, XXXXXXX, XXXXXXX, MC_commit, MC_mv, MC_branch |
| 175 | #define _______________________GIT_L4______________________ _______, _______, _______, _______, _______, _______ | 174 | #define _______________________GIT_L4______________________ _______, _______, _______, _______, _______, _______ |
| 176 | 175 | ||
| 177 | #define _______________________GIT_R1______________________ XXXXXXX, GIT_PUL, GIT_INT, GIT_RMT, GIT_PSH, XXXXXXX | 176 | #define _______________________GIT_R1______________________ XXXXXXX, MC_pull, MC_init, MC_remote, MC_push, XXXXXXX |
| 178 | #define _______________________GIT_R2______________________ GIT_STH, XXXXXXX, GIT_CHK, GIT_LOG, XXXXXXX, XXXXXXX | 177 | #define _______________________GIT_R2______________________ MC_stash, XXXXXXX, MC_checkout, MC_log, XXXXXXX, XXXXXXX |
| 179 | #define _______________________GIT_R3______________________ XXXXXXX, GIT_MRG, XXXXXXX, XXXXXXX, XXXXXXX, _______ | 178 | #define _______________________GIT_R3______________________ XXXXXXX, MC_merge, XXXXXXX, XXXXXXX, XXXXXXX, _______ |
| 180 | #define _______________________GIT_R4______________________ _______, _______, _______, _______, XXXXXXX, XXXXXXX | 179 | #define _______________________GIT_R4______________________ _______, _______, _______, _______, XXXXXXX, XXXXXXX |
| 181 | 180 | ||
| 182 | 181 | ||
| 183 | /* MIT Layout (Convenience) | 182 | /* MIT Layout (Convenience) |
| 184 | * | 183 | * |
| 185 | * The Convenience layer adds a tenkey and miscellaneous chords to the keyboard. | 184 | * The Convenience layer adds miscellaneous chords to the keyboard. |
| 186 | * The lack of a fifth row means that some of the tenkey's functions need to be | ||
| 187 | * moved to the left of tenkey from the top. | ||
| 188 | * | 185 | * |
| 189 | * - The Number Lock key is physically in the same spot as the Caps Lock key | 186 | * - The Number Lock key is physically in the same spot as the Caps Lock key |
| 190 | * in the raise layer. | 187 | * in the raise layer. |
| 191 | * - There is also a Backspace Key for convenience. | 188 | * - There is also a Backspace Key for convenience. |
| 192 | * - There is a convenience macro to type the Control-Alt-Delete login chord for Windows. | 189 | * - There is a convenience macro to type the Control-Alt-Delete login chord for Windows. |
| 193 | * - There is a convenience macro to Minimize Remote Desktop within Remote Desktop | 190 | * - There is a convenience macro to switch context from the Remote Desktop to the local |
| 194 | * in Windows. | 191 | * machine in Windows. |
| 195 | * - There is a convenience macro to cycle through programs in Windows. | 192 | * - There are convenience macros to switch between virtual desktops in Windows. |
| 196 | * - There is a convenience macro to go to the previous program in Windows. | 193 | * - There are convenience macros to create and delete virtual desktops in Windows. |
| 197 | * | 194 | * |
| 198 | * ,-----------------------------------. ,-----------------------------------. | 195 | * ,-----------------------------------. ,-----------------------------------. |
| 199 | * | | |Insrt|ScrLk|PrtSc| | | * | 7 | 8 | 9 | - |BkSpc| | 196 | * | | |Insrt|ScrLk|PrtSc| | | | | | | |BkSpc| |
| 200 | * |-----------------------------------| |-----------------------------------| | 197 | * |-----------------------------------| |-----------------------------------| |
| 201 | * | | | App | LCAD|MRDP7|NmLck| | / | 4 | 5 | 6 | + | | | 198 | * | | | App | LCAD|MRDCC|NmLck| |MVTDL|MVTDC|MVTDN|MVTDR| | | |
| 202 | * |-----------------------------------| |-----------------------------------| | 199 | * |-----------------------------------| |-----------------------------------| |
| 203 | * | | | | ATRD|MRDP8| | | | 1 | 2 | 3 |Enter| | | 200 | * | | | | | | | | | | | | | | |
| 204 | * |-----------------------------------| |-----------------------------------| | 201 | * |-----------------------------------| |-----------------------------------| |
| 205 | * | | | | | | | | | 0 | 0 | . | | | | 202 | * | | | | | | | | | | | | | | |
| 206 | * `-----------------------------------' `-----------------------------------' | 203 | * `-----------------------------------' `-----------------------------------' |
| 207 | */ | 204 | */ |
| 208 | 205 | ||
| 209 | #define ___________________CONVENIENCE_L1__________________ XXXXXXX, XXXXXXX, KC_INS, KC_SLCK, KC_PSCR, XXXXXXX | 206 | #define ___________________CONVENIENCE_L1__________________ XXXXXXX, XXXXXXX, KC_INS, KC_SLCK, KC_PSCR, XXXXXXX |
| 210 | #define ___________________CONVENIENCE_L2__________________ _______, XXXXXXX, KC_APP, MC_LCAD, MC_MRD7, KC_NLCK | 207 | #define ___________________CONVENIENCE_L2__________________ _______, XXXXXXX, KC_APP, MC_lcad, MC_rdcc, KC_NLCK |
| 211 | #define ___________________CONVENIENCE_L3__________________ _______, XXXXXXX, XXXXXXX, MC_ATRD, MC_MRD8, XXXXXXX | 208 | #define ___________________CONVENIENCE_L3__________________ _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX |
| 212 | #define ___________________CONVENIENCE_L4__________________ _______, _______, _______, _______, _______, _______ | 209 | #define ___________________CONVENIENCE_L4__________________ _______, _______, _______, _______, _______, _______ |
| 210 | |||
| 211 | #define ___________________CONVENIENCE_R1__________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSPC | ||
| 212 | #define ___________________CONVENIENCE_R2__________________ MC_vtdl, MC_vtdc, MC_vtdn, MC_vtdr, XXXXXXX, XXXXXXX | ||
| 213 | #define ___________________CONVENIENCE_R3__________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ | ||
| 214 | #define ___________________CONVENIENCE_R4__________________ _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX | ||
| 215 | |||
| 216 | /* Convenience macros | ||
| 217 | * | ||
| 218 | * These are accelerator macros for simplifying declaration of PROGMEM strings | ||
| 219 | */ | ||
| 220 | |||
| 221 | // Declare variable name | ||
| 222 | #define CUSTOM_VAR(VAR) mc_##VAR | ||
| 223 | |||
| 224 | // Declare PROGMEM string using the variable name | ||
| 225 | #define CUSTOM_DEF(VAR) const char CUSTOM_VAR(VAR)[] PROGMEM = | ||
| 226 | |||
| 227 | // Declare enum name | ||
| 228 | #define CUSTOM_ENUM(VAR) MC_##VAR | ||
| 229 | |||
| 230 | #define CUSTOM_MACRO_STRING(X) X | ||
| 231 | |||
| 232 | #define COMMA_DELIM(...) , | ||
| 233 | #define SEMI_DELIM(...) ; | ||
| 234 | |||
| 235 | #define DROP(...) | ||
| 236 | |||
| 237 | /* Keycode synchronization macros | ||
| 238 | * | ||
| 239 | * These macros help synchronize the keycodes between the string declaration, string pointer declaration, and enum order. | ||
| 240 | */ | ||
| 241 | |||
| 213 | 242 | ||
| 214 | #define ___________________CONVENIENCE_R1__________________ KC_PAST, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_BSPC | 243 | #define CUSTOM_MACROS(CUSTOM_NAME, CUSTOM_STRING, CUSTOM_DELIM) \ |
| 215 | #define ___________________CONVENIENCE_R2__________________ KC_PSLS, KC_P4, KC_P5, KC_P6, KC_PPLS, XXXXXXX | 244 | CUSTOM_NAME(add) CUSTOM_STRING("git add ") CUSTOM_DELIM() \ |
| 216 | #define ___________________CONVENIENCE_R3__________________ XXXXXXX, KC_P1, KC_P2, KC_P3, KC_PENT, _______ | 245 | CUSTOM_NAME(branch) CUSTOM_STRING("git branch ") CUSTOM_DELIM() \ |
| 217 | #define ___________________CONVENIENCE_R4__________________ _______, KC_P0, KC_P0, KC_PDOT, XXXXXXX, XXXXXXX | 246 | CUSTOM_NAME(checkout) CUSTOM_STRING("git checkout ") CUSTOM_DELIM() \ |
| 247 | CUSTOM_NAME(cherrypick) CUSTOM_STRING("git cherry-pick ") CUSTOM_DELIM() \ | ||
| 248 | CUSTOM_NAME(commit) CUSTOM_STRING("git commit -m \"\""SS_TAP(X_LEFT)) CUSTOM_DELIM() \ | ||
| 249 | CUSTOM_NAME(diff) CUSTOM_STRING("git diff ") CUSTOM_DELIM() \ | ||
| 250 | CUSTOM_NAME(fetch) CUSTOM_STRING("git fetch ") CUSTOM_DELIM() \ | ||
| 251 | CUSTOM_NAME(grep) CUSTOM_STRING("git grep ") CUSTOM_DELIM() \ | ||
| 252 | CUSTOM_NAME(log) CUSTOM_STRING("git log --decorate --oneline --graph ") CUSTOM_DELIM() \ | ||
| 253 | CUSTOM_NAME(init) CUSTOM_STRING("git init ") CUSTOM_DELIM() \ | ||
| 254 | CUSTOM_NAME(mv) CUSTOM_STRING("git mv ") CUSTOM_DELIM() \ | ||
| 255 | CUSTOM_NAME(merge) CUSTOM_STRING("git merge ") CUSTOM_DELIM() \ | ||
| 256 | CUSTOM_NAME(push) CUSTOM_STRING("git push ") CUSTOM_DELIM() \ | ||
| 257 | CUSTOM_NAME(pull) CUSTOM_STRING("git pull ") CUSTOM_DELIM() \ | ||
| 258 | CUSTOM_NAME(rebase) CUSTOM_STRING("git rebase ") CUSTOM_DELIM() \ | ||
| 259 | CUSTOM_NAME(remote) CUSTOM_STRING("git remote ") CUSTOM_DELIM() \ | ||
| 260 | CUSTOM_NAME(reset) CUSTOM_STRING("git reset ") CUSTOM_DELIM() \ | ||
| 261 | CUSTOM_NAME(show) CUSTOM_STRING("git show ") CUSTOM_DELIM() \ | ||
| 262 | CUSTOM_NAME(stash) CUSTOM_STRING("git stash ") CUSTOM_DELIM() \ | ||
| 263 | CUSTOM_NAME(status) CUSTOM_STRING("git status ") CUSTOM_DELIM() \ | ||
| 264 | CUSTOM_NAME(tag) CUSTOM_STRING("git tag ") CUSTOM_DELIM() \ | ||
| 265 | CUSTOM_NAME(rdcc) CUSTOM_STRING(SS_LCTL(SS_LALT(SS_TAP(X_HOME)))) CUSTOM_DELIM() \ | ||
| 266 | CUSTOM_NAME(lcad) CUSTOM_STRING(SS_LCTL(SS_LALT(SS_TAP(X_DELETE)))) CUSTOM_DELIM() \ | ||
| 267 | CUSTOM_NAME(vtdl) CUSTOM_STRING(SS_LCTL(SS_LGUI(SS_TAP(X_LEFT)))) CUSTOM_DELIM() \ | ||
| 268 | CUSTOM_NAME(vtdc) CUSTOM_STRING(SS_LCTL(SS_LGUI(SS_TAP(X_F4)))) CUSTOM_DELIM() \ | ||
| 269 | CUSTOM_NAME(vtdn) CUSTOM_STRING(SS_LCTL(SS_LGUI("d"))) CUSTOM_DELIM() \ | ||
| 270 | CUSTOM_NAME(vtdr) CUSTOM_STRING(SS_LCTL(SS_LGUI(SS_TAP(X_RIGHT)))) | ||
