diff options
-rw-r--r-- | keyboards/planck/keymaps/dr_notsokind/Readme.md | 82 | ||||
-rw-r--r-- | keyboards/planck/keymaps/dr_notsokind/keymap.c | 118 |
2 files changed, 135 insertions, 65 deletions
diff --git a/keyboards/planck/keymaps/dr_notsokind/Readme.md b/keyboards/planck/keymaps/dr_notsokind/Readme.md index 2caf4965d0..35f3975c6a 100644 --- a/keyboards/planck/keymaps/dr_notsokind/Readme.md +++ b/keyboards/planck/keymaps/dr_notsokind/Readme.md @@ -1,8 +1,10 @@ # Dr NotSoKind's layout -Feel free to ask questions or send suggestions to [me on Twitter](https://twitter.com/pnikosis) +*Feel free to ask questions or send suggestions to [me on Twitter](https://twitter.com/pnikosis)* -I love some features from the default layout, although there are things that definitively I can't get used to. The *circuit* layout gave me some good ideas, so I combined both, plus some own ideas to fit better my needs. BTW, I don't use Dvorak or other layouts than QWERTY and I'm too old and grumpy for learning something new (I'm lying a bit here, I learn new stuff every day), so I removed the ther typing layouts +I love some features from the default layout, although there are things that definitively I can't get used to. Other layouts such as *circuit* gave me some good ideas, so I combined them all plus some own stuff to fit better my needs. + +BTW, I don't use Dvorak or other layouts than QWERTY and I'm too old and grumpy for learning something new (I'm lying a bit here, I learn new stuff every day), so I removed the ther typing layouts ## Things I love about the default layout 1. I love the consistency between the raise and lower layers, like one is the shifted version of the other. @@ -14,53 +16,81 @@ I love some features from the default layout, although there are things that def 3. Alt and Super. Switched them too. ## Needs, changes and goals -1. Arrow keys and distributed "traditionally". +1. Arrow keys distributed "traditionally". 2. Media keys easily accessible. 3. A button for Sleep/Power. 4. As close as possible to a US QWERTY layout. 5. A Numpad, for when I want to feel like an accountant. 6. Be able to record Dynamic Macros. +7. Zoom in and Zoom out (basically Ctrl - and Ctrl +) + +I've been experimenting a lot and I think I'm getting closer to my customization end game. + +## Layers: + +## Main Layer / QWERTY + +Apart from the default, lower and raise, I added an extra Media/Action layer, for volume and playback control, plus some keyboard actions such as Print Screen, Insert, Calculator or Power/Sleep/Wake. Also in the [MEDIA] layer, you can record two different macros and reproduce them. + +### About the volume up and down + +That was a hard decision. I wanted the vol up, down and mute easily accessible, and in an obvious palce. I finally decided to use the `Raise` and `Lower` modifier keys to manage the volume, in combination with the [MEDIA] modifier key. This could look a little weird, since the modifier keys are having a different function than modify the layer, but ended up working fairly well, so while pressing [MEDIA] you have the `Lower` key to put the volume down, `Raise` to raise the volume, and `Space` for mute. + +### Zoom in and Zoom out + +Using the [MEDIA] modifier you can zoom in and zoom out in browsers and other applications using `,` (for zooming out) and `.` (for zooming in). These keys are mapped to `LCTRL -` and `LCTRL =`. I initially thought about mapping zoom in to `LCTRL +` but most apps also map the zoom in using the `=` key, and some they don't event support zooming in with `+` (I'm looking at you Sublime Text). + +### Right Shift and Enter + +`RSHFT` and `ENTER` are combined. Tap once for `ENTER` and hold for `RSHFT`. `ENTER` will be registered on release if released within 200 ms, else `RSHFT` is registered starting at 201 ms until release. + +If for some reason, this interferes with the normal usage of the `ENTER` key in any way, (some problem that may never happen), there is a regular non-modified `ENTER` key on the same key in the [LOWER] and [RAISE] layers, as well in the [LOCK] mode (see below). -Layers: +### Caps Lock -### Main Layout / QWERTY +`LSHFT` and `CAPS` are also combined. The key works like a normal `LSHFT` unless double-tapped, in which case it counts as `CAPS`. This functionality unfortunately delays all key presses by at most 200 ms, but I have added ways to disable this both temporarily or permanently, described below. -Has four modes: The default, Lower, Raise and Media. +A normal behavior for `LSHFT` key is on the same key in the [LOWER], [RAISE] and [MEDIA] layers (so you can double tap it, as in IntelliJ IDEA), you can also use the [LOCK] mode. -![Main](https://i.imgur.com/x4wSt76.png) +### Copy/Paste + +There are `UNDO`, `CUT`, `COPY`, and `PASTE` keys with the [MEDIA] modifier. This was intended to be a universal way to use these commands since in macOS cut is `⌘ + C` but in Windows it is `⌃ + C`. Unfortunately these special keys only work in Windows. + +### How to record and play dynamic Macros + +I wanted the macros a little "harder" to start recording than usual, since I didn't want to accidentally delete a macro. Also I wanted to share the same key for storing and reproducing the macros, made more sense for me than using one key for storing the Macro1, and use another one for reproducing that Macro. + +**Record a Macro** + +Press `Media` and `LCtrl` (that's left control), you will hear a beep if you have the audio on. Then choose where you want to store the Macro, in `;` or `'`, so press that key, you will now hear a tone for the macro start being recorded. + +When you are done, press `Media` and `Enter`. You will finally hear a tune confirming that the macro has been stored. + +**Play a Macro** + +Press `Media` and the key where you stored your Macro, either `;` or `'`. The Macro will play. + +![Imgur](https://i.imgur.com/TCsD6Ro.png) http://www.keyboard-layout-editor.com/#/gists/4cfb26f84bbb4fabe5e6c7cc22c85e24 -Media gives access to most media keys, and some keyboard actions such as Print Screen, Insert, Calculator or Power/Sleep/Wake. Also in the Media layer, you can record two different macros and reproduce them. +## Lock Mode -Record the Macro with `Media` + `;` (or `Media` + `'` for the Macro 2), you will hear a beep (if the audio is enabled). Do your stuff, finish recording with `Media` + `Enter`. For reproducing the Macro, press `Media` + `,` (or `Media` + `.` for the second Macro). +The Lock mode toggle disables the double-tap `CAPS` and disables `GUI` keys (WINDOWS key), also makes `ENTER` behave normally (not `RSHIFT` when hold). -Additionally, Lower + Raise gives access to the layer switching, plus keyboard modes (such as music mode), reset, SysReq and Lock Mode, which disables the double shift tap for CapsLock (taken from the *circuit* layout). Also provides another distribution for the F keys. +## Lower + Raise (adjust) Layer -### Lower + Raise (adjust) +Lower + Raise gives access to the layer switching, plus keyboard modes (such as enabling music mode for annoying your coworkers), reset, SysReq and Lock Mode, which disables the double shift tap for CapsLock (taken from the *circuit* layout, see the comments below). Also provides another distribution for the F keys. ![Adjust](https://i.imgur.com/ADNLR6n.png) http://www.keyboard-layout-editor.com/#/gists/12462bfba17d16bb40b54ed914209d92 -### Numpad - -Pressing Esc exits the numpad layer (also you can go to the QWERTY layer through the adjust layer) +## Numpad Layer ![Numpad](https://i.imgur.com/iTyhjNZ.png) http://www.keyboard-layout-editor.com/#/gists/5ab730ab278d2050c5250498806e8edc --------------------------------------- -Notes taken from the circuit layout: - -### Special keys: -* `RSHFT` and `ENTER` are combined. Tap once for `ENTER` and hold for `RSHFT`. `ENTER` will be registered on release if released within 200 ms, else `RSHFT` is registered starting at 201 ms until release. -* If for some reason, this interferes with the normal usage of the `ENTER` key in any way, (some problem that may never happen), I have added a regular non-modified `ENTER` key on the same key in the [LOWER] and [RAISE] layers. -* `LSHFT` and `CAPS` are also combined. The key works like a normal `LSHFT` unless double-tapped, in which case it counts as `CAPS`. This functionality unfortunately delays all key presses by at most 200 ms, but I have added ways to disable this both temporarily or permanently, described below. -* A failsafe `CAPS` key is on the same key in the [LOWER] and [RAISE] layers. -* There are `UNDO`, `CUT`, `COPY`, and `PASTE` keys. This was intended to be a universal way to use these commands since in macOS cut is `⌘ + C` but in Windows it is `⌃ + C`. Unfortunately these special keys only work in Windows. ¯\\\_(ツ)\_/¯ - -##Game lock: -**TL;DR** the game lock toggle disables the double-tap `CAPS`, and disables `GUI` keys (WINDOWS key). +This layer is mostly for quick typing numbers using the numpad. You have NumLock available to switch before the keypad numbers or the actions (movement, del, insert, etc). Esc serves as a quick way to go abck to the QWERTY layer (also you can go to the QWERTY layer through the adjust layer). diff --git a/keyboards/planck/keymaps/dr_notsokind/keymap.c b/keyboards/planck/keymaps/dr_notsokind/keymap.c index e95c02eda0..b360b39da1 100644 --- a/keyboards/planck/keymaps/dr_notsokind/keymap.c +++ b/keyboards/planck/keymaps/dr_notsokind/keymap.c @@ -13,13 +13,14 @@ extern keymap_config_t keymap_config; // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _NUMPAD 1 -#define _LOCKED 2 -#define _RAISE 3 -#define _LOWER 4 -#define _FUNCTN 5 -#define _MEDIA 6 +#define _QWERTY 0 +#define _NUMPAD 1 +#define _LOCKED 2 +#define _RAISE 3 +#define _LOWER 4 +#define _FUNCTN 5 +#define _MEDIA 6 +#define _ONESHOT 7 enum planck_keycodes { QWERTY = SAFE_RANGE, @@ -27,23 +28,27 @@ enum planck_keycodes { RAISE, LOWER, MEDIA, + ONESHOT, DYNAMIC_MACRO_RANGE }; #include "dynamic_macro.h" // Key code names -#define SFT_ENT FUNC(0) // Tap for enter, hold for right shift -#define LOCK FUNC(1) -#define KC_PSTE KC_PASTE -#define _______ KC_TRNS -#define XXXXXXX KC_NO +#define SFT_ENT FUNC(0) // Tap for enter, hold for right shift +#define LOCK FUNC(1) +#define KC_PSTE KC_PASTE +#define _______ KC_TRNS +#define XXXXXXX KC_NO +#define ZOOM_IN LCTL(KC_EQL) +#define ZOOM_OUT LCTL(KC_MINS) +#define ZOOM_NML LCTL(KC_0) #ifdef TAP_DANCE_ENABLE -#define SFT_CAP TD(0) // Left shift, double tap for caps +#define SFT_CAP TD(0) // Left shift, double tap for caps #endif #ifndef TAP_DANCE_ENABLE -#define SFT_CAP KC_LSFT // Regular left shift +#define SFT_CAP KC_LSFT // Regular left shift #endif // Tap Dance Definitions @@ -117,13 +122,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }, /* RAISE - * ,-----------------------------------------------------------------------------------. * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BKSP | * |------+------+------+------+------+------+------+------+------+------+------+------| * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | CAPS | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | NULL | PgUp | Enter| + * |LShift| F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | NULL | PgUp | Enter| * |------+------+------+------+------+-------------+------+------+------+------+------| * | | | | Vol+ | | NULL | | | Home | PgDn | End | * `-----------------------------------------------------------------------------------' @@ -131,7 +135,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_RAISE] = { {KC_GRV , KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_DEL , KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_CAPS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, XXXXXXX, KC_PGUP, KC_ENT }, + {KC_LSFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, XXXXXXX, KC_PGUP, KC_ENT }, {_______, _______, _______, KC_VOLU, _______, XXXXXXX, XXXXXXX, _______, _______, KC_HOME, KC_PGDN, KC_END } }, @@ -141,7 +145,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | Del | F13 | F14 | F15 | F16 | F17 | F18 | _ | + | { | } | | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | CAPS | F19 | F20 | F21 | F22 | F23 | F24 |ISO ~ |ISO | | NULL | PgUp | Enter| + * |LShift| F19 | F20 | F21 | F22 | F23 | F24 |ISO ~ |ISO | | NULL | PgUp | Enter| * |------+------+------+------+------+-------------+------+------+------+------+------| * | | | | Vol- | | NULL | | | Home | PgDn | End | * `-----------------------------------------------------------------------------------' @@ -149,7 +153,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LOWER] = { {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL }, {KC_DEL, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, - {KC_CAPS, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, S(KC_NUHS), S(KC_NUBS), XXXXXXX, KC_PGUP, KC_ENT }, + {KC_LSFT, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, S(KC_NUHS), S(KC_NUBS), XXXXXXX, KC_PGUP, KC_ENT }, {_______, _______, _______, KC_VOLD, _______, XXXXXXX, XXXXXXX, _______, _______, KC_HOME, KC_PGDN, KC_END } }, @@ -157,18 +161,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------------------------------------------------. * |Sleep | NULL |WbHome| NULL | NULL | NULL |Again | NULL |Insert| NULL |PrntSc|Power | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Wake | NULL |WbSrch| NULL | Find | NULL | NULL | NULL | Calc | NULL |RecMc1|RecMc2| + * | Wake | NULL |WbSrch| NULL | Find | NULL | NULL | NULL | Calc | NULL |PlyMc1|PlyMc2| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | NULL | Undo | Cut | Copy | Paste| NULL | NULL | NULL |Macro1|Macro2| Prev | NULL | + * |LShift| Undo | Cut | Copy | Paste| NULL | NULL | NULL |ZoomOu|ZoomIn| Prev | NULL | * |------+------+------+------+------+-------------+------+------+------+------+------| * | NULL | NULL | NULL | | Vol- | Mute | Vol+ | NULL | Stop | Next | Play | * `-----------------------------------------------------------------------------------' */ [_MEDIA] = { - {KC_SLEP, XXXXXXX, KC_WHOM, XXXXXXX, XXXXXXX, XXXXXXX, KC_AGAIN, XXXXXXX, KC_INS, XXXXXXX, KC_PSCR, KC_PWR}, - {KC_WAKE, XXXXXXX, KC_WSCH, XXXXXXX, KC_FIND, XXXXXXX, XXXXXXX, XXXXXXX, KC_CALC, XXXXXXX, DYN_REC_START1, DYN_REC_START2 }, - {XXXXXXX, KC_UNDO, KC_CUT, KC_COPY, KC_PSTE, XXXXXXX, XXXXXXX, XXXXXXX, DYN_MACRO_PLAY1, DYN_MACRO_PLAY2, KC_MPRV, DYN_REC_STOP }, - {XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_VOLD, KC_MUTE, KC_MUTE, KC_VOLU, XXXXXXX, KC_MSTP, KC_MNXT, KC_MPLY } + {KC_SLEP, XXXXXXX, KC_WHOM, XXXXXXX, XXXXXXX, XXXXXXX, KC_AGAIN, XXXXXXX, KC_INS, XXXXXXX, KC_PSCR, KC_PWR}, + {KC_WAKE, XXXXXXX, KC_WSCH, XXXXXXX, KC_FIND, XXXXXXX, XXXXXXX, XXXXXXX, KC_CALC, XXXXXXX, DYN_MACRO_PLAY1, DYN_MACRO_PLAY2 }, + {KC_LSFT, KC_UNDO, KC_CUT, KC_COPY, KC_PSTE, XXXXXXX, XXXXXXX, XXXXXXX, ZOOM_OUT, ZOOM_IN, KC_MPRV, DYN_REC_STOP }, + {ONESHOT, XXXXXXX, XXXXXXX, _______, KC_VOLD, KC_MUTE, KC_MUTE, KC_VOLU, ZOOM_NML, KC_MSTP, KC_MNXT, KC_MPLY } +}, + +/* ONESHOT + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | |RecMc1|RecMc2| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ONESHOT] = { + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, DYN_REC_START1, DYN_REC_START2}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} }, /* FUNCTIONS @@ -177,9 +199,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 | F21 | F22 | F23 | F24 | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | NULL | NULL | NULL |AudOff|MusOff|QWERTY|NUMPAD|Mus On|Aud On| NULL |Voice+|SysReq| + * | NULL | Reset| NULL |AudOff|MusOff|QWERTY|NUMPAD|Mus On|Aud On| NULL |Voice+|SysReq| * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Reset| NULL | Lock | NULL | | NULL | | NULL |AGNorm|Voice-|AGSwap| + * | NULL | NULL | Lock | NULL | | NULL | | NULL |AGNorm|Voice-|AGSwap| * `-----------------------------------------------------------------------------------' */ [_FUNCTN] = { @@ -195,30 +217,48 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_numpad[][2] = SONG(NUM_LOCK_ON_SOUND); -float tone_dyn_macro_rec[][2] = SONG(TERMINAL_SOUND); +float tone_oneshot[][2] = SONG(TERMINAL_SOUND); +float tone_dyn_macro_rec[][2] = SONG(SONIC_RING); float tone_dyn_macro_stop[][2] = SONG(COIN_SOUND); float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif +void press_key(uint16_t key) { + register_code(key); + unregister_code(key); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { - uint16_t macro_kc = (keycode == NUMPAD ? DYN_REC_STOP : keycode); - if (!process_record_dynamic_macro(macro_kc, record)) { + // uint16_t macro_kc = (keycode == ONESHOT ? DYN_REC_STOP : keycode); + if (!process_record_dynamic_macro(keycode, record)) { + switch(keycode) { + case DYN_REC_START1: + case DYN_REC_START2: +#ifdef AUDIO_ENABLE + PLAY_SONG(tone_dyn_macro_rec); +#endif + break; + case DYN_REC_STOP: +#ifdef AUDIO_ENABLE + PLAY_SONG(tone_dyn_macro_stop); +#endif + break; + } return false; } switch (keycode) { - case DYN_REC_START1: - case DYN_REC_START2: -#ifdef AUDIO_ENABLE - PLAY_SONG(tone_dyn_macro_rec); -#endif - break; - case DYN_REC_STOP: + case ONESHOT: + if (record->event.pressed) { + layer_on(_ONESHOT); + set_oneshot_layer(_ONESHOT, ONESHOT_START); + clear_oneshot_layer_state(ONESHOT_PRESSED); #ifdef AUDIO_ENABLE - PLAY_SONG(tone_dyn_macro_stop); + PLAY_SONG(tone_oneshot); #endif - break; + } + return false; + break; case QWERTY: if (record->event.pressed) { if (IS_LAYER_ON(_NUMPAD)) { |