diff options
Diffstat (limited to 'users/noroadsleft')
| -rw-r--r-- | users/noroadsleft/noroadsleft.c | 83 | ||||
| -rw-r--r-- | users/noroadsleft/noroadsleft.h | 2 | ||||
| -rw-r--r-- | users/noroadsleft/readme.md | 43 |
3 files changed, 31 insertions, 97 deletions
diff --git a/users/noroadsleft/noroadsleft.c b/users/noroadsleft/noroadsleft.c index 82b0b0568..28bfa9e6c 100644 --- a/users/noroadsleft/noroadsleft.c +++ b/users/noroadsleft/noroadsleft.c | |||
| @@ -17,11 +17,6 @@ | |||
| 17 | #include "noroadsleft.h" | 17 | #include "noroadsleft.h" |
| 18 | #include "version.h" | 18 | #include "version.h" |
| 19 | 19 | ||
| 20 | /******************* | ||
| 21 | ** MODIFIER MASKS ** | ||
| 22 | *******************/ | ||
| 23 | bool macroMode = 0; | ||
| 24 | |||
| 25 | __attribute__((weak)) | 20 | __attribute__((weak)) |
| 26 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }; | 21 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }; |
| 27 | 22 | ||
| @@ -73,60 +68,35 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 73 | return false; | 68 | return false; |
| 74 | case M_SALL: | 69 | case M_SALL: |
| 75 | if (record->event.pressed) { | 70 | if (record->event.pressed) { |
| 76 | if ( macroMode == 1 ) { | 71 | tap_code16(C(KC_A)); |
| 77 | SEND_STRING(SS_LGUI("a")); | ||
| 78 | } else { | ||
| 79 | SEND_STRING(SS_LCTL("a")); | ||
| 80 | } | ||
| 81 | } | 72 | } |
| 82 | return false; | 73 | return false; |
| 83 | case M_UNDO: | 74 | case M_UNDO: |
| 84 | if (record->event.pressed) { | 75 | if (record->event.pressed) { |
| 85 | if ( macroMode == 1 ) { | 76 | register_code(KC_LCTL); |
| 86 | if ( get_mods() & MOD_MASK_SHIFT ) { | 77 | register_code(KC_Z); |
| 87 | SEND_STRING(SS_LSFT(SS_LGUI("z"))); | 78 | } else { |
| 88 | } else { | 79 | unregister_code(KC_Z); |
| 89 | SEND_STRING(SS_LGUI("z")); | 80 | unregister_code(KC_LCTL); |
| 90 | } | ||
| 91 | } else { | ||
| 92 | SEND_STRING(SS_LCTL("z")); | ||
| 93 | } | ||
| 94 | } | 81 | } |
| 95 | return false; | 82 | return false; |
| 96 | case M_CUT: | 83 | case M_CUT: |
| 97 | if (record->event.pressed) { | 84 | if (record->event.pressed) { |
| 98 | if ( macroMode == 1 ) { | 85 | tap_code16(C(KC_X)); |
| 99 | SEND_STRING(SS_LGUI("x")); | ||
| 100 | } else { | ||
| 101 | SEND_STRING(SS_LCTL("x")); | ||
| 102 | } | ||
| 103 | } | 86 | } |
| 104 | return false; | 87 | return false; |
| 105 | case M_COPY: | 88 | case M_COPY: |
| 106 | if (record->event.pressed) { | 89 | if (record->event.pressed) { |
| 107 | if ( macroMode == 1 ) { | 90 | tap_code16(C(KC_C)); |
| 108 | SEND_STRING(SS_LGUI("c")); | ||
| 109 | } else { | ||
| 110 | SEND_STRING(SS_LCTL("c")); | ||
| 111 | } | ||
| 112 | } | 91 | } |
| 113 | return false; | 92 | return false; |
| 114 | case M_PASTE: | 93 | case M_PASTE: |
| 115 | if (record->event.pressed) { | 94 | if (record->event.pressed) { |
| 116 | if ( macroMode == 1 ) { | 95 | register_code(KC_LCTL); |
| 117 | if ( get_mods() & MOD_MASK_SHIFT ) { | 96 | register_code(KC_V); |
| 118 | SEND_STRING(SS_LSFT(SS_LALT(SS_LGUI("v")))); | 97 | } else { |
| 119 | } else { | 98 | unregister_code(KC_V); |
| 120 | SEND_STRING(SS_LGUI("v")); | 99 | unregister_code(KC_LCTL); |
| 121 | } | ||
| 122 | } else { | ||
| 123 | SEND_STRING(SS_LCTL("v")); | ||
| 124 | } | ||
| 125 | } | ||
| 126 | return false; | ||
| 127 | case M_MDSWP: | ||
| 128 | if (record->event.pressed) { | ||
| 129 | macroMode ^= 1; | ||
| 130 | } | 100 | } |
| 131 | return false; | 101 | return false; |
| 132 | case KC_1 ... KC_0: | 102 | case KC_1 ... KC_0: |
| @@ -159,33 +129,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 159 | } | 129 | } |
| 160 | } | 130 | } |
| 161 | return false; | 131 | return false; |
| 162 | case KC_PSCR: | ||
| 163 | if (record->event.pressed) { | ||
| 164 | if ( macroMode == 1 ) { | ||
| 165 | tap_code16(G(S(KC_3))); | ||
| 166 | } else { | ||
| 167 | tap_code(KC_PSCR); | ||
| 168 | } | ||
| 169 | } | ||
| 170 | return false; | ||
| 171 | case KC_HOME: | ||
| 172 | if (record->event.pressed) { | ||
| 173 | if ( macroMode == 1 ) { | ||
| 174 | tap_code16(G(KC_LEFT)); | ||
| 175 | } else { | ||
| 176 | tap_code(KC_HOME); | ||
| 177 | } | ||
| 178 | } | ||
| 179 | return false; | ||
| 180 | case KC_END: | ||
| 181 | if (record->event.pressed) { | ||
| 182 | if ( macroMode == 1 ) { | ||
| 183 | tap_code16(G(KC_RGHT)); | ||
| 184 | } else { | ||
| 185 | tap_code(KC_END); | ||
| 186 | } | ||
| 187 | } | ||
| 188 | return false; | ||
| 189 | } // switch() | 132 | } // switch() |
| 190 | return true; | 133 | return true; |
| 191 | }; | 134 | }; |
diff --git a/users/noroadsleft/noroadsleft.h b/users/noroadsleft/noroadsleft.h index 52bcec0ab..12bb5b465 100644 --- a/users/noroadsleft/noroadsleft.h +++ b/users/noroadsleft/noroadsleft.h | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include QMK_KEYBOARD_H | 19 | #include QMK_KEYBOARD_H |
| 20 | 20 | ||
| 21 | #define MOD_MASK_RALT (MOD_BIT(KC_RALT)) | 21 | #define MOD_MASK_RALT (MOD_BIT(KC_RALT)) |
| 22 | extern bool macroMode; | ||
| 23 | 22 | ||
| 24 | enum userspace_keycodes { | 23 | enum userspace_keycodes { |
| 25 | VRSN = SAFE_RANGE, | 24 | VRSN = SAFE_RANGE, |
| @@ -31,7 +30,6 @@ enum userspace_keycodes { | |||
| 31 | M_CUT, | 30 | M_CUT, |
| 32 | M_COPY, | 31 | M_COPY, |
| 33 | M_PASTE, | 32 | M_PASTE, |
| 34 | M_MDSWP, | ||
| 35 | KEYMAP_SAFE_RANGE | 33 | KEYMAP_SAFE_RANGE |
| 36 | }; | 34 | }; |
| 37 | 35 | ||
diff --git a/users/noroadsleft/readme.md b/users/noroadsleft/readme.md index 1173d15ec..e8279c033 100644 --- a/users/noroadsleft/readme.md +++ b/users/noroadsleft/readme.md | |||
| @@ -13,7 +13,7 @@ This directory holds the code that's the same for every keyboard I use in QMK, w | |||
| 13 | 13 | ||
| 14 | Outputs a string that tells me the Git commit from which my flashed firmware was built. Looks something like: | 14 | Outputs a string that tells me the Git commit from which my flashed firmware was built. Looks something like: |
| 15 | 15 | ||
| 16 | kc60:noroadsleft @ 0.6.326-6-gae6d7b-dirty | 16 | kc60:noroadsleft # @ 0.6.326-6-gae6d7b-dirty |
| 17 | 17 | ||
| 18 | ### Git Macros | 18 | ### Git Macros |
| 19 | 19 | ||
| @@ -21,40 +21,37 @@ Some frequently used Git commands. | |||
| 21 | 21 | ||
| 22 | | Keycode | Output | Output with <kbd>Shift</kbd> | | 22 | | Keycode | Output | Output with <kbd>Shift</kbd> | |
| 23 | | :---------------------------------- | :--------------------- | :--------------------------- | | 23 | | :---------------------------------- | :--------------------- | :--------------------------- | |
| 24 | | [`G_PUSH`](./noroadsleft.c#L49-L53) | `git push origin ` | `git push origin ` | | 24 | | [`G_PUSH`](./noroadsleft.c#L44-L48) | `git push origin ` | `git push origin ` | |
| 25 | | [`G_FTCH`](./noroadsleft.c#L54-L63) | `git fetch upstream ` | `git pull upstream ` | | 25 | | [`G_FTCH`](./noroadsleft.c#L49-L58) | `git fetch upstream ` | `git pull upstream ` | |
| 26 | | [`G_BRCH`](./noroadsleft.c#L64-L73) | `master` | `$(git branch-name)` | | 26 | | [`G_BRCH`](./noroadsleft.c#L59-L68) | `master` | `$(git branch-name)` | |
| 27 | 27 | ||
| 28 | `$(git branch-name)` is an alias for `git rev-parse --abbrev-ref HEAD`, which normally returns the name of the current branch. | 28 | `$(git branch-name)` is an alias for `git rev-parse --abbrev-ref HEAD`, which normally returns the name of the current branch. |
| 29 | 29 | ||
| 30 | ### "Macro Mode" Macros and Customized Keycodes | 30 | ### Customized Keycodes |
| 31 | 31 | ||
| 32 | Some of my macros and keycodes do different things depending on the value of the [`macroMode` variable](./noroadsleft.c#L23), which is [toggled between `0` and `1`](./noroadsleft.c#L127-L131) by the `M_MDSWP` custom keycode.[<sup>1</sup>](#footnotes) This is mainly at attempt to make various shortcuts use the same physical key combinations between Windows/Linux and MacOS (which I use at home and work, respectively). | 32 | I used to have a boolean variable that changed the functionality of these keycodes, but I no longer work in the environment that I wrote the functionality for, so I took it out. The keycodes still exist because all my `keymap.c` files reference the custom keycodes I defined. |
| 33 | 33 | ||
| 34 | | Keycode | `macroMode == 0` | `macroMode == 1` | `macroMode == 1` with <kbd>Shift</kbd> | | 34 | | Keycode | Action | |
| 35 | | :------------------------------------- | :--------------- | :--------------- | :------------------------------------- | | 35 | | :------------------------------------ | :-------- | |
| 36 | | [`M_SALL`](./noroadsleft.c#L74-L82) | `Ctrl+A` | `Cmd+A` | `Cmd+A` | | 36 | | [`M_SALL`](./noroadsleft.c#L69-L73) | `Ctrl+A` | |
| 37 | | [`M_UNDO`](./noroadsleft.c#L83-L95) | `Ctrl+Z` | `Cmd+Z` | `Cmd+Shift+Z` | | 37 | | [`M_UNDO`](./noroadsleft.c#L74-L82) | `Ctrl+Z` | |
| 38 | | [`M_CUT`](./noroadsleft.c#L96-L104) | `Ctrl+X` | `Cmd+X` | `Cmd+X` | | 38 | | [`M_CUT`](./noroadsleft.c#L83-L87) | `Ctrl+X` | |
| 39 | | [`M_COPY`](./noroadsleft.c#L105-L113) | `Ctrl+C` | `Cmd+C` | `Cmd+C` | | 39 | | [`M_COPY`](./noroadsleft.c#L88-L92) | `Ctrl+C` | |
| 40 | | [`M_PASTE`](./noroadsleft.c#L114-L126) | `Ctrl+V` | `Cmd+V` | `Cmd+Shift+Opt+V` | | 40 | | [`M_PASTE`](./noroadsleft.c#L93-L101) | `Ctrl+V` | |
| 41 | | [`KC_PSCR`](./noroadsleft.c#L162-L170) | `KC_PSCR` | `Cmd+Shift+3` | `Cmd+Shift+3` | | ||
| 42 | | [`KC_HOME`](./noroadsleft.c#L171-L179) | `KC_HOME` | `Cmd+Left` | `Cmd+Left` | | ||
| 43 | | [`KC_END`](./noroadsleft.c#L180-L188) | `KC_END` | `Cmd+Right` | `Cmd+Right` | | ||
| 44 | 41 | ||
| 45 | ### [Emulated Non-US Backslash](./noroadsleft.c#L32-L42) | 42 | ### [Emulated Non-US Backslash](./noroadsleft.c#L27-L37) |
| 46 | 43 | ||
| 47 | Sometimes I type in languages from countries that use ISO layout, but my keyboards are all ANSI layout, so I have one key fewer than necessary. | 44 | Sometimes I type in languages from countries that use ISO layout, but my keyboards are all ANSI layout, so I have one key fewer than necessary. |
| 48 | 45 | ||
| 49 | This macro simulates the Non-US Backslash key if I hold Right Alt and tap the key to the right of Left Shift. | 46 | This macro simulates the Non-US Backslash key if I hold Right Alt and tap the key to the right of Left Shift. |
| 50 | 47 | ||
| 51 | Requires defining `ANSI_NUBS_ROW` and `ANSI_NUBS_COL` in `config.h` at the keymap level.[<sup>2</sup>](#footnotes) | 48 | Requires defining `ANSI_NUBS_ROW` and `ANSI_NUBS_COL` in `config.h` at the keymap level.[<sup>1</sup>](#footnotes) |
| 52 | 49 | ||
| 53 | ### [Emulated Numeric Keypad](./noroadsleft.c#L132-L146) | 50 | ### [Emulated Numeric Keypad](./noroadsleft.c#L102-L116) |
| 54 | 51 | ||
| 55 | If I hold the Right Alt key, the number row (`KC_1` through `KC_0`) will output numpad keycodes instead of number row keycodes, enabling quicker access to characters like ™ and °. | 52 | If I hold the Right Alt key, the number row (`KC_1` through `KC_0`) will output numpad keycodes instead of number row keycodes, enabling quicker access to characters like ™ and °. |
| 56 | 53 | ||
| 57 | ### [Emulated Extended Function Keys](./noroadsleft.c#L147-L161) | 54 | ### [Emulated Extended Function Keys](./noroadsleft.c#L117-L131) |
| 58 | 55 | ||
| 59 | Similar to the emulated numpad, if I hold the Right Alt key with the Fn key, the function row (`KC_F1` through `KC_F12`) will output keycodes `KC_F13` throught `KC_F24`. | 56 | Similar to the emulated numpad, if I hold the Right Alt key with the Fn key, the function row (`KC_F1` through `KC_F12`) will output keycodes `KC_F13` throught `KC_F24`. |
| 60 | 57 | ||
| @@ -79,11 +76,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 79 | 76 | ||
| 80 | ## Footnotes | 77 | ## Footnotes |
| 81 | 78 | ||
| 82 | - 1: [^](#macro-mode-macros-and-customized-keycodes) The `M_MDSWP` keycode is used in my keymaps in the following locations: | 79 | - 1: [^](#emulated-non-us-backslash) `ANSI_NUBS_ROW` and `ANSI_NUBS_COL` are in the following locations: |
| 83 | - [KC60](../../keyboards/kc60/keymaps/noroadsleft/keymap.c#L111) | ||
| 84 | - [KBDfans KBD75 rev1](../../keyboards/kbdfans/kbd75/keymaps/noroadsleft/keymap.c#L93) | ||
| 85 | - [CoseyFannitutti Discipline](../../keyboards/coseyfannitutti/discipline/keymaps/noroadsleft/keymap.c#L66) | ||
| 86 | - 2: [^](#emulated-non-us-backslash) `ANSI_NUBS_ROW` and `ANSI_NUBS_COL` are in the following locations: | ||
| 87 | - [KC60](../../keyboards/kc60/keymaps/noroadsleft/config.h#L35-L36) | 80 | - [KC60](../../keyboards/kc60/keymaps/noroadsleft/config.h#L35-L36) |
| 88 | - [KBDfans KBD75 rev1](../../keyboards/kbdfans/kbd75/keymaps/noroadsleft/config.h#L26-L27) | 81 | - [KBDfans KBD75 rev1](../../keyboards/kbdfans/kbd75/keymaps/noroadsleft/config.h#L26-L27) |
| 89 | - [CoseyFannitutti Discipline](../../keyboards/coseyfannitutti/discipline/keymaps/noroadsleft/config.h#L19-L20) | 82 | - [CoseyFannitutti Discipline](../../keyboards/coseyfannitutti/discipline/keymaps/noroadsleft/config.h#L19-L20) |
