1
0
Fork 0

Merge pull request #792 from hot-leaf-juice/master

Big restructure, plus mouse and some convenience keys.
This commit is contained in:
Jack Humbert 2016-09-29 23:31:59 -04:00 committed by GitHub
commit d3fdc3a00f
2 changed files with 207 additions and 78 deletions

View File

@ -14,14 +14,21 @@ extern keymap_config_t keymap_config;
#define _BASE 0 #define _BASE 0
#define _MOVE 1 #define _MOVE 1
#define _SYMB 2 #define _SYMB 2
#define _FUNC 3 #define _MOUSE 3
#define _FUNC 4
enum planck_keycodes { enum planck_keycodes {
BASE = SAFE_RANGE, MOVE = SAFE_RANGE,
MOVE,
SYMB, SYMB,
FUNC, FUNC,
LOCK CMDLEFT,
CMDRGHT,
BELOW,
ABOVE,
DASH,
GBP,
VOLUP,
VOLDN
}; };
// Fillers to make layering more clear // Fillers to make layering more clear
@ -33,73 +40,91 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* BASE /* BASE
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | - | * | Tab | Q | W | F | P | G | J | L | U | Y | ; | - |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Bksp | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Func | Ctrl | Alt | GUI | Symb |Enter |Space | Move | GUI | Alt | Ctrl |Caps | * | Bksp | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Func | Ctrl | Alt | Cmd | Symb | Enter| Space| Move | Cmd | Alt | Ctrl | Func |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_BASE] = { [_BASE] = {
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS}, {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS},
{KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
{FUNC, KC_LCTL, KC_LALT, KC_LGUI, SYMB, KC_ENT, KC_SPC, MOVE, KC_RGUI, KC_RALT, KC_RCTL, KC_CAPS} {FUNC, KC_LCTL, KC_LALT, KC_LGUI, SYMB, KC_ENT, KC_SPC, MOVE, KC_RGUI, KC_RALT, KC_RCTL, FUNC }
}, },
/* MOVE /* MOVE
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | Esc | | Home | Up | End | | | Home | Up | End | | Esc | * | Esc | | Cmd-L| Up | Cmd-R| | | Cmd-L| Up | Cmd-R| | Esc |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | | Left | Down |Right | | | Left | Down |Right | | Del |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | |Pg Up |Pg Dn | | |Pg Dn |Pg Up | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | | * | Del | | Left | Down | Right| | | Left | Down | Right| | Del |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | Pg Up| Pg Dn| Above| | Pg Dn| Pg Up| | Caps | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | Below| | | | | | |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_MOVE] = { [_MOVE] = {
{KC_ESC, _______, KC_HOME, KC_UP, KC_END, _______, _______, KC_HOME, KC_UP, KC_END, _______, KC_ESC}, {KC_ESC, XXXXXXX, CMDLEFT, KC_UP, CMDRGHT, XXXXXXX, XXXXXXX, CMDLEFT, KC_UP, CMDRGHT, XXXXXXX, KC_ESC },
{KC_DEL, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, KC_DEL}, {KC_DEL, KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_CAPS, KC_DEL },
{_______, _______, _______, KC_PGUP, KC_PGDN, _______, _______, KC_PGDN, KC_PGUP, _______, _______, _______}, {_______, XXXXXXX, XXXXXXX, KC_PGUP, KC_PGDN, ABOVE, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX, XXXXXXX, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} {_______, _______, _______, _______, _______, BELOW, _______, _______, _______, _______, _______, _______}
}, },
/* SYMB /* SYMB
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Esc | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
* |-----------------------------------------------------------------------------------. * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Del | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | * | Del | ! | @ | # | $ | % | ^ | & | * | ( | ) | £ |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | ~ | ` | + | = | | | \ | [ | ] | { | } | | * | | ~ | ` | + | = | | | \ | [ | ] | { | } | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | | * | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_SYMB] = { [_SYMB] = {
{KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_ESC }, {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, DASH },
{KC_DEL, 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_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, GBP },
{_______, KC_TILD, KC_GRV, KC_PLUS, KC_EQL, KC_PIPE, KC_BSLS, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, _______}, {_______, KC_TILD, KC_GRV, KC_PLUS, KC_EQL, KC_PIPE, KC_BSLS, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
}, },
/* MOUSE
* ,-----------------------------------------------------------------------------------.
* | | | ACC-2| ACC-1| ACC-0| | | SW-L | M-U | SW-R | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | MB-3 | MB-2 | MB-1 | | | M-L | M-D | M-R | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | SW-D | SW-U | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_MOUSE] = {
{XXXXXXX, XXXXXXX, KC_ACL2, KC_ACL1, KC_ACL0, XXXXXXX, XXXXXXX, KC_WH_L, KC_MS_U, KC_WH_R, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, KC_BTN3, KC_BTN2, KC_BTN1, XXXXXXX, XXXXXXX, KC_MS_L, KC_MS_D, KC_MS_R, XXXXXXX, XXXXXXX},
{_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_WH_D, KC_WH_U, XXXXXXX, XXXXXXX, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* FUNC /* FUNC
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | F12 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | * | Reset| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | Vol+ |
* |-----------------------------------------------------------------------------------.
* | | Play | Prev | Next | BL+ | | | Lock | | | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | Mute | Vol- | Vol+ | BL- | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |Reset | * | | F11 | F12 | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 | Vol- |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | F21 | F22 | F23 | F24 | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | Prev | Mute | Play | Next | | | | |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_FUNC] = { [_FUNC] = {
{KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 }, {RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, VOLUP },
{_______, KC_MPLY, KC_MPRV, KC_MNXT, KC_PAUS, _______, _______, LOCK, _______, _______, _______, _______}, {XXXXXXX, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, VOLDN },
{_______, KC_MUTE, KC_VOLD, KC_VOLU, KC_SLCK, _______, _______, _______, _______, _______, _______, _______}, {_______, KC_F21, KC_F22, KC_F23, KC_F24, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET } {_______, _______, _______, _______, KC_MPRV, KC_MUTE, KC_MPLY, KC_MNXT, _______, _______, _______, _______}
} }
}; };
@ -109,20 +134,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case MOVE: case MOVE:
if (record->event.pressed) { if (record->event.pressed) {
layer_on(_MOVE); layer_on(_MOVE);
update_tri_layer(_MOVE, _SYMB, _FUNC); update_tri_layer(_MOVE, _SYMB, _MOUSE);
} else { } else {
layer_off(_MOVE); layer_off(_MOVE);
update_tri_layer(_MOVE, _SYMB, _FUNC); update_tri_layer(_MOVE, _SYMB, _MOUSE);
} }
return false; return false;
break; break;
case SYMB: case SYMB:
if (record->event.pressed) { if (record->event.pressed) {
layer_on(_SYMB); layer_on(_SYMB);
update_tri_layer(_MOVE, _SYMB, _FUNC); update_tri_layer(_MOVE, _SYMB, _MOUSE);
} else { } else {
layer_off(_SYMB); layer_off(_SYMB);
update_tri_layer(_MOVE, _SYMB, _FUNC); update_tri_layer(_MOVE, _SYMB, _MOUSE);
} }
return false; return false;
break; break;
@ -134,15 +159,91 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
return false; return false;
break; break;
case LOCK: case CMDLEFT:
if (record->event.pressed) { if (record->event.pressed) {
register_code(KC_RSFT); register_code(KC_LGUI);
register_code(KC_RCTL); register_code(KC_LEFT);
register_code(KC_POWER);
} else { } else {
unregister_code(KC_POWER); unregister_code(KC_LEFT);
unregister_code(KC_RCTL); unregister_code(KC_LGUI);
unregister_code(KC_RSFT); }
return false;
break;
case CMDRGHT:
if (record->event.pressed) {
register_code(KC_LGUI);
register_code(KC_RGHT);
} else {
unregister_code(KC_RGHT);
unregister_code(KC_LGUI);
}
return false;
break;
case BELOW:
if (record->event.pressed) {
register_code(KC_LGUI);
register_code(KC_RGHT);
unregister_code(KC_RGHT);
unregister_code(KC_LGUI);
register_code(KC_ENT);
unregister_code(KC_ENT);
}
return false;
break;
case ABOVE:
if (record->event.pressed) {
register_code(KC_LGUI);
register_code(KC_LEFT);
unregister_code(KC_LEFT);
unregister_code(KC_LGUI);
register_code(KC_ENT);
unregister_code(KC_ENT);
register_code(KC_UP);
unregister_code(KC_UP);
}
return false;
break;
case DASH:
if (record->event.pressed) {
register_code(KC_LALT);
register_code(KC_MINS);
} else {
unregister_code(KC_MINS);
unregister_code(KC_LALT);
}
return false;
break;
case GBP:
if (record->event.pressed) {
register_code(KC_LALT);
register_code(KC_3);
} else {
unregister_code(KC_3);
unregister_code(KC_LALT);
}
return false;
break;
case VOLUP:
if (record->event.pressed) {
register_code(KC_LALT);
register_code(KC_LSFT);
register_code(KC_VOLU);
} else {
unregister_code(KC_VOLU);
unregister_code(KC_LSFT);
unregister_code(KC_LALT);
}
return false;
break;
case VOLDN:
if (record->event.pressed) {
register_code(KC_LALT);
register_code(KC_LSFT);
register_code(KC_VOLD);
} else {
unregister_code(KC_VOLD);
unregister_code(KC_LSFT);
unregister_code(KC_LALT);
} }
return false; return false;
break; break;

View File

@ -2,42 +2,70 @@
This is a layout for the grid planck, built with a few ideals in mind: This is a layout for the grid planck, built with a few ideals in mind:
- Minimal response times should be maintained. i.e. keys that react differently depending on whether they are tapped or held, keys that react differently if they are double tapped, etc. should be avoided — they inevitably send their keycode later than a normal key, interrupting the immediate feedback from the screen. Therefore we restrict ourselves to chording. - Minimal response times should be maintained. Keys that react differently depending on whether they are tapped or held, keys that react differently if they are double tapped, etc. should be avoided they inevitably send their keycode later than a normal key interrupting the immediate feedback from the screen. Therefore we restrict ourselves to chording as our only means of getting more than one symbol out of a single physical key.
- The hands should never need to leave the home position. The usual culprit for this is the arrow cluster, so the arrow cluster should be as close to home as possible. - The hands should never need to leave the home position. The usual culprit for this is the arrow cluster, so the arrow cluster should be as close to home as possible.
- There should be two of every modifier (one on each side), otherwise certain long key combinations become hard to make. - There should be two of every modifier (one on each side), otherwise certain long key combinations become hard to make.
- Backspace should be in the “capslock position” in the colemak tradition.
We have four layers. A `BASE` layer, in colemak; a `MOVE` layer, with an arrow cluster etc, a `SYMB` layer, with numbers and symbols; and a `FUNC` layer, with function keys and media keys. We have five layers. A `BASE` layer, in colemak; a `MOVE` layer, with an arrow cluster and other movement keys; a `SYMB` layer, with numbers and symbols; a `FUNC` layer, with function keys and media keys; and a `MOUSE` layer, with mouse emulation.
## The `BASE` layer ```
![](http://i.imgur.com/tVNI3SE.png) /* BASE
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | - |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Bksp | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Func | Ctrl | Alt | Cmd | Symb | Enter| Space| Move | Cmd | Alt | Ctrl | Func |
* `-----------------------------------------------------------------------------------'
*/
This is the default layer; in [colemak](https://colemak.com). `esc` and `del` are conspicuously absent but are especially easy to reach from either of the other main layers (see below). The `backspace` location is standard colemak. The `caps` key is still on the `BASE` layer but only because I dont really use the bottom corners so theres nothing else I would rather put there. Having `enter` on a thumb means I can still have `quote` immediately to the right of `O`, something that would have annoyed me endlessly otherwise. `minus` is in the upper right because I had an extra space and its probably my next most used key that didnt yet have a home. /* MOVE
* ,-----------------------------------------------------------------------------------.
* | Esc | | Cmd-L| Up | Cmd-R| | | Cmd-L| Up | Cmd-R| | Esc |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Del | | Left | Down | Right| | | Left | Down | Right| | Del |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | Pg Up| Pg Dn| Above| | Pg Dn| Pg Up| | Caps | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | Below| | | | | | |
* `-----------------------------------------------------------------------------------'
*/
The `MOVE` and `SYMB` layers are reached by holding down the `move` and `symb` keys respectively. The `FUNC` layer is reached by holding down both the `move` and `symb` keys simultaneously, *or* by holding down the `fn` key. The intended use is that whenever both hands are on the keyboard, the former method is used, and the latter is only used when, for example, reaching over to the keyboard with one hand to access the media controls. /* SYMB
* ,-----------------------------------------------------------------------------------.
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Del | ! | @ | # | $ | % | ^ | & | * | ( | ) | £ |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | ~ | ` | + | = | | | \ | [ | ] | { | } | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
## The `MOVE` layer /* MOUSE
![](http://i.imgur.com/KXRSuHT.png) * ,-----------------------------------------------------------------------------------.
* | | | ACC-2| ACC-1| ACC-0| | | SW-L | M-U | SW-R | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | MB-3 | MB-2 | MB-1 | | | M-L | M-D | M-R | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | SW-D | SW-U | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
This is fairly self explanatory. I almost exclusively use the right hand cluster so that movement is a one handed affair, but the left hand cluster is there if its needed. /* FUNC
* ,-----------------------------------------------------------------------------------.
On *macOS* I recommend using [Karabiner](https://pqrs.org/osx/karabiner/) and ticking *Use PC Style Home/End #2* and *Use PC Style PageUp/PageDown* so that `home` and `end` jump you to the beginning and end of the line respectively and so that `pg up` and `pg dn` move the cursor instead of just scrolling. * | Reset| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | Vol+ |
* |------+------+------+------+------+------+------+------+------+------+------+------|
None of the modifiers are overwritten so that `shift-alt-arrows` etc work as expected. * | | F11 | F12 | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 | Vol- |
* |------+------+------+------+------+------+------+------+------+------+------+------|
## The `SYMB` layer * | | F21 | F22 | F23 | F24 | | | | | | | |
![](http://i.imgur.com/thh1ne2.png) * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | Prev | Mute | Play | Next | | | | |
The symbol layer has all the numbers and their usual corresponding symbols in the first two rows, with the symbols on the home row since I use them more frequently than the numbers. The third row contains all the remaining symbols, arranged roughly so that the most used symbols are accessible with the strongest fingers. * `-----------------------------------------------------------------------------------'
*/
`esc` and `del` are repeated here since I wanted to be able to reach either, one handed, with either hand. ```
Again none of the modifiers are overwritten so that shortcuts involving numbers or symbols work as expected.
## The `FUNC` layer
![](http://i.imgur.com/1VKFBBU.png)
The only things of note here are that `bl+` and `bl-` are short for *backlight up* and *backlight down*, and in firmware are actually `KC_PAUS` and `KC_SLCK` respectively, since *macOS* interprets these as the backlight keys. And that `lock` is currently a macro hard coded to turn off the screen on *macOS*. (By activating the shortcut `shift-ctrl-power`.)
## Other changes from the default
I have LEDs and sound disabled, simply because I have no need of them.