diff options
| author | James Young <18669334+noroadsleft@users.noreply.github.com> | 2021-02-10 11:17:42 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-10 20:17:42 +0100 |
| commit | 5a73558a211383cd238587369ef043a6d5b64b88 (patch) | |
| tree | e9d1d0b3c104aca439911a74d6ff6b801b2e8d78 /users | |
| parent | 4b2ab84c71d517b718bdf4dde0e60fc71026fac6 (diff) | |
| download | qmk_firmware-5a73558a211383cd238587369ef043a6d5b64b88.tar.gz qmk_firmware-5a73558a211383cd238587369ef043a6d5b64b88.zip | |
[Keymap] add noroadsleft userspace; add and update keymaps (#11686)
Diffstat (limited to 'users')
| -rw-r--r-- | users/noroadsleft/noroadsleft.c | 153 | ||||
| -rw-r--r-- | users/noroadsleft/noroadsleft.h | 38 | ||||
| -rw-r--r-- | users/noroadsleft/readme.md | 40 | ||||
| -rw-r--r-- | users/noroadsleft/rules.mk | 1 |
4 files changed, 232 insertions, 0 deletions
diff --git a/users/noroadsleft/noroadsleft.c b/users/noroadsleft/noroadsleft.c new file mode 100644 index 000000000..6fb223f9e --- /dev/null +++ b/users/noroadsleft/noroadsleft.c | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | /* Copyright 2020 James Young (@noroadsleft) | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "noroadsleft.h" | ||
| 18 | #include "version.h" | ||
| 19 | |||
| 20 | /******************* | ||
| 21 | ** MODIFIER MASKS ** | ||
| 22 | *******************/ | ||
| 23 | bool macroMode = 0; | ||
| 24 | |||
| 25 | __attribute__((weak)) | ||
| 26 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }; | ||
| 27 | |||
| 28 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 29 | if (!process_record_keymap(keycode, record)) { | ||
| 30 | return false; | ||
| 31 | } | ||
| 32 | switch (keycode) { | ||
| 33 | case VRSN: | ||
| 34 | if (record->event.pressed) { | ||
| 35 | SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | ||
| 36 | } | ||
| 37 | return false; | ||
| 38 | case G_PUSH: | ||
| 39 | if (record->event.pressed) { | ||
| 40 | SEND_STRING("git push origin "); | ||
| 41 | }; | ||
| 42 | return false; | ||
| 43 | case G_FTCH: | ||
| 44 | if (record->event.pressed) { | ||
| 45 | if ( get_mods() & MOD_MASK_SHIFT ) { | ||
| 46 | clear_mods(); | ||
| 47 | SEND_STRING("git pull upstream "); | ||
| 48 | } else { | ||
| 49 | SEND_STRING("git fetch upstream "); | ||
| 50 | } | ||
| 51 | }; | ||
| 52 | return false; | ||
| 53 | case G_BRCH: | ||
| 54 | if (record->event.pressed) { | ||
| 55 | if ( get_mods() & MOD_MASK_SHIFT ) { | ||
| 56 | clear_mods(); | ||
| 57 | SEND_STRING("master"); | ||
| 58 | } else { | ||
| 59 | SEND_STRING("$(git branch-name)"); | ||
| 60 | } | ||
| 61 | }; | ||
| 62 | return false; | ||
| 63 | case M_SALL: | ||
| 64 | if (record->event.pressed) { | ||
| 65 | if ( macroMode == 1 ) { | ||
| 66 | SEND_STRING(SS_LGUI("a")); | ||
| 67 | } else { | ||
| 68 | SEND_STRING(SS_LCTL("a")); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | return false; | ||
| 72 | case M_UNDO: | ||
| 73 | if (record->event.pressed) { | ||
| 74 | if ( macroMode == 1 ) { | ||
| 75 | if ( get_mods() & MOD_MASK_SHIFT ) { | ||
| 76 | SEND_STRING(SS_LSFT(SS_LGUI("z"))); | ||
| 77 | } else { | ||
| 78 | SEND_STRING(SS_LGUI("z")); | ||
| 79 | } | ||
| 80 | } else { | ||
| 81 | SEND_STRING(SS_LCTL("z")); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | return false; | ||
| 85 | case M_CUT: | ||
| 86 | if (record->event.pressed) { | ||
| 87 | if ( macroMode == 1 ) { | ||
| 88 | SEND_STRING(SS_LGUI("x")); | ||
| 89 | } else { | ||
| 90 | SEND_STRING(SS_LCTL("x")); | ||
| 91 | } | ||
| 92 | } | ||
| 93 | return false; | ||
| 94 | case M_COPY: | ||
| 95 | if (record->event.pressed) { | ||
| 96 | if ( macroMode == 1 ) { | ||
| 97 | SEND_STRING(SS_LGUI("c")); | ||
| 98 | } else { | ||
| 99 | SEND_STRING(SS_LCTL("c")); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | return false; | ||
| 103 | case M_PASTE: | ||
| 104 | if (record->event.pressed) { | ||
| 105 | if ( macroMode == 1 ) { | ||
| 106 | if ( get_mods() & MOD_MASK_SHIFT ) { | ||
| 107 | SEND_STRING(SS_LSFT(SS_LALT(SS_LGUI("v")))); | ||
| 108 | } else { | ||
| 109 | SEND_STRING(SS_LGUI("v")); | ||
| 110 | } | ||
| 111 | } else { | ||
| 112 | SEND_STRING(SS_LCTL("v")); | ||
| 113 | } | ||
| 114 | } | ||
| 115 | return false; | ||
| 116 | case M_MDSWP: | ||
| 117 | if (record->event.pressed) { | ||
| 118 | macroMode ^= 1; | ||
| 119 | } | ||
| 120 | return false; | ||
| 121 | case KC_1 ... KC_0: | ||
| 122 | if (record->event.pressed) { | ||
| 123 | if (get_mods() & MOD_MASK_RALT) { | ||
| 124 | register_code(keycode + 0x3B); | ||
| 125 | } else { | ||
| 126 | register_code(keycode); | ||
| 127 | } | ||
| 128 | } else { | ||
| 129 | if (get_mods() & MOD_MASK_RALT) { | ||
| 130 | unregister_code(keycode + 0x3B); | ||
| 131 | } else { | ||
| 132 | unregister_code(keycode); | ||
| 133 | } | ||
| 134 | } | ||
| 135 | return false; | ||
| 136 | case KC_F1 ... KC_F12: | ||
| 137 | if (record->event.pressed) { | ||
| 138 | if (get_mods() & MOD_MASK_RALT) { | ||
| 139 | register_code(keycode + 0x2E); | ||
| 140 | } else { | ||
| 141 | register_code(keycode); | ||
| 142 | } | ||
| 143 | } else { | ||
| 144 | if (get_mods() & MOD_MASK_RALT) { | ||
| 145 | unregister_code(keycode + 0x2E); | ||
| 146 | } else { | ||
| 147 | unregister_code(keycode); | ||
| 148 | } | ||
| 149 | } | ||
| 150 | return false; | ||
| 151 | } // switch() | ||
| 152 | return true; | ||
| 153 | }; | ||
diff --git a/users/noroadsleft/noroadsleft.h b/users/noroadsleft/noroadsleft.h new file mode 100644 index 000000000..2d597219f --- /dev/null +++ b/users/noroadsleft/noroadsleft.h | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | /* Copyright 2020 James Young (@noroadsleft) | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include QMK_KEYBOARD_H | ||
| 20 | |||
| 21 | #define MOD_MASK_RALT (MOD_BIT(KC_RALT)) | ||
| 22 | extern bool macroMode; | ||
| 23 | |||
| 24 | enum userspace_keycodes { | ||
| 25 | VRSN = SAFE_RANGE, | ||
| 26 | G_PUSH, | ||
| 27 | G_FTCH, | ||
| 28 | G_BRCH, | ||
| 29 | M_SALL, | ||
| 30 | M_UNDO, | ||
| 31 | M_CUT, | ||
| 32 | M_COPY, | ||
| 33 | M_PASTE, | ||
| 34 | M_MDSWP, | ||
| 35 | KEYMAP_SAFE_RANGE | ||
| 36 | }; | ||
| 37 | |||
| 38 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record); | ||
diff --git a/users/noroadsleft/readme.md b/users/noroadsleft/readme.md new file mode 100644 index 000000000..f018a4227 --- /dev/null +++ b/users/noroadsleft/readme.md | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | # @noroadsleft's Userspace | ||
| 2 | |||
| 3 | This directory holds the code that's the same for every keyboard I use in QMK, which is currently: | ||
| 4 | |||
| 5 | | Status | Keyboard | | ||
| 6 | | :----------------- | :------- | | ||
| 7 | | :heavy_check_mark: | `kc60` | ||
| 8 | | :heavy_check_mark: | `kbdfans/kbd75/rev1` | ||
| 9 | |||
| 10 | ## Features | ||
| 11 | |||
| 12 | ### Emulated Non-US Backslash | ||
| 13 | |||
| 14 | Sends `KC_NUBS` when the Z key is tapped while the Right Alt key is being held. | ||
| 15 | |||
| 16 | ### Emulated Numeric Keypad | ||
| 17 | |||
| 18 | Turns number row keycodes into their numeric keypad equivalents while the Right Alt key is being held. | ||
| 19 | |||
| 20 | ### Emulated F13-F24 | ||
| 21 | |||
| 22 | Turns F1-F12 into F13-F24 while the Right Alt key is being held. | ||
| 23 | |||
| 24 | |||
| 25 | ## License | ||
| 26 | |||
| 27 | Copyright 2020 noroadsleft | ||
| 28 | |||
| 29 | This program is free software: you can redistribute it and/or modify | ||
| 30 | it under the terms of the GNU General Public License as published by | ||
| 31 | the Free Software Foundation, either version 2 of the License, or | ||
| 32 | (at your option) any later version. | ||
| 33 | |||
| 34 | This program is distributed in the hope that it will be useful, | ||
| 35 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 36 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 37 | GNU General Public License for more details. | ||
| 38 | |||
| 39 | You should have received a copy of the GNU General Public License | ||
| 40 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
diff --git a/users/noroadsleft/rules.mk b/users/noroadsleft/rules.mk new file mode 100644 index 000000000..2ae198814 --- /dev/null +++ b/users/noroadsleft/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| SRC += noroadsleft.c \ No newline at end of file | |||
