Skip to content

Commit

Permalink
333fred layout update (qmk#1971)
Browse files Browse the repository at this point in the history
* Set up tap dance for layers on the lower button.

* Refactored code to share in the users directory between my two keyboard layouts.

* Small keyboard layout change.

* Updated documentation on oneshot usage in macros/tap dance.
  • Loading branch information
333fred authored and jackhumbert committed Nov 6, 2017
1 parent 16843bc commit 89357b9
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 73 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ cmake-build-debug
*.stackdump
util/Win_Check_Output.txt
# Let these ones be user specific, since we have so many different configurations
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/tasks.json
.vscode/last.sql
Expand Down
4 changes: 4 additions & 0 deletions docs/feature_advanced_keycodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Once you have a good feel for how layers work and what you can do, you can get m
Layers stack on top of each other in numerical order. When determining what a keypress does, QMK scans the layers from the top down, stopping when it reaches the first active layer that is not set to `KC_TRNS`. As a result if you activate a layer that is numerically lower than your current layer, and your current layer (or another layer that is active and higher than your target layer) has something other than `KC_TRNS`, that is the key that will be sent, not the key on the layer you just activated. This is the cause of most people's "why doesn't my layer get switched" problem.
Sometimes, you might want to switch between layers in a macro or as part of a tap dance routine. `layer_on` activates a layer, and `layer_off` deactivates it. More layer-related functions can be found in [action_layer.h](../tmk_core/common/action_layer.h).
# Modifier keys
These functions allow you to combine a mod with a keycode. When pressed the keydown for the mod will be sent first, and then *kc* will be sent. When released the keyup for *kc* will be sent and then the mod will be sent.
Expand Down Expand Up @@ -145,6 +147,8 @@ You can control the behavior of one shot keys by defining these in `config.h`:
* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](#mod-tap), not the `KC_*` codes.
* `OSL(layer)` - momentary switch to *layer*.

Sometimes, you want to activate a one-shot layer as part of a macro or tap dance routine. To do this, you need to call `set_oneshot_layer(LAYER, ONESHOT_START)` on key down, and `set_oneshot_layer(ONESHOT_PRESSED)` on key up. If you want to cancel the oneshot, call `reset_oneshot_layer()`. For more complicated actions, take a look at the oneshot implementation in [`process_record`](../tmk_core/common/action.c#L429).

## Permissive Hold

As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new `config.h` option:
Expand Down
8 changes: 4 additions & 4 deletions keyboards/nyquist/keymaps/333fred/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This nyquist layout is based on my Ergodox Infinity Layout, which is [here](../.
## Layers

### QWERTY
The shift modifiers on this layer all use OSM to allow for quick single capitalization. Press and hold F to go to the VIM movement layer. Layer is also a one-shot layer toggle, and can be held down to type multiple characters on the Lower layer. Game is a regular toggle layer.
The shift modifiers on this layer all use OSM to allow for quick single capitalization. LwrVIM acts a combo one-shot toggle and momentary layer toggle. Tap once to make the next key be sent on the Lower. Hold to move to the Lower layer until release. Tap and hold (so press, release, press and hold) to move to the VIM layer until release. Game is a regular toggle layer.

```
Qwerty
Expand All @@ -14,11 +14,11 @@ Qwerty
|------+------+------+------+------+------+------+------+------+------+------+------|
| Tab | Q | W | E | R | T | Y | U | I | O | P | \ |
|------+------+------+------+------+-------------+------+------+------+------+------|
| Esc | A | S | D |LTVIMF| G | H | J | K | L | ; | " |
| Esc | A | S | D | F | G | H | J | K | L | ; | " |
|------+------+------+------+------+------|------+------+------+------+------+------|
| Shift| Z | X | C | V | B | N | M | , | . |/ Ctrl| Shift|
|------+------+------+------+------+------+------+------+------+------+------+------|
| Ctrl | Alt | F4 | GUI |Lower | Bksp | Spc | Ent | Lock | = | Game | Del |
| Ctrl | Alt | F4 | GUI |LwrVIM| Bksp | Spc | Ent | Lock | = | RAlt | Del |
`-----------------------------------------------------------------------------------'
```

Expand All @@ -36,7 +36,7 @@ Lower
|------+------+------+------+------+------|------+------+------+------+------+------|
| APscr| % | ^ | [ | ] | ~ | 1 | 2 | 3 | \ | Vol- | Vol+ |
|------+------+------+------+------+------+------+------+------+------+------+------|
| Pscr | | | | | | 0 | . | = | Prev | Next | Play |
| Pscr | | | | | GAME | 0 | . | = | Prev | Next | Play |
`-----------------------------------------------------------------------------------'
```

Expand Down
57 changes: 30 additions & 27 deletions keyboards/nyquist/keymaps/333fred/keymap.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
#include "nyquist.h"
#include "action_layer.h"
#include "action_util.h"
#include "eeconfig.h"
#include "333fred.h"

extern keymap_config_t keymap_config;

#define _QWERTY 0
#define _LOWER 1
#define _VIM 2
#define _GAME 3

enum custom_macros {
DLEFT,
DRIGHT,
PSCREEN_APP
};

// Tap dance for layer transitions
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
Expand All @@ -27,22 +25,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Tab | Q | W | E | R | T | Y | U | I | O | P | \ |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | D |LTVIMF| G | H | J | K | L | ; | " |
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . |/ Ctrl| Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | Alt | F4 | GUI |Lower | Bksp | Spc | Ent | Alt | + | Game | Del |
* | Ctrl | Alt | F4 | GUI |Lwr/VM| Bksp | Spc | Ent | Lock | = | Alt | Del |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = KEYMAP( \
[BASE] = KEYMAP( \
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, \
KC_ESC, KC_A, KC_S, KC_D, LT(_VIM, KC_F), KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RCTL_T(KC_SLSH), OSM(MOD_RSFT), \
KC_LCTL, KC_LALT, KC_F4, KC_LGUI, OSL(_LOWER), KC_BSPC, KC_SPC, KC_ENT, KC_LOCK, KC_EQL, TG(_GAME), KC_DEL \
KC_LCTL, KC_LALT, KC_F4, KC_LGUI, TD(TD_SYM_VIM), KC_BSPC, KC_SPC, KC_ENT, KC_LOCK, KC_EQL, KC_RALT, KC_DEL \
),

/* Lower
/* Symbols
* ,-----------------------------------------------------------------------------------.
* | Caps | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 |
* |------+------+------+------+------+-------------+------+------+------+------+------|
Expand All @@ -52,36 +50,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | APscr| % | ^ | [ | ] | ~ | 1 | 2 | 3 | \ | Vol- | Vol+ |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Pscr | | | | | | 0 | . | = | Prev | Next | Play |
* | Pscr | | | | | GAME | 0 | . | = | Prev | Next | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = KEYMAP( \
KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, \
_______, KC_EXLM, KC_AT, KC_LPRN, KC_RPRN, KC_PIPE, KC_7, KC_8, KC_9, KC_ASTR, KC_RPRN, KC_F12, \
_______, KC_HASH, KC_DLR, KC_LCBR, KC_RCBR, KC_GRV, KC_4, KC_5, KC_6, KC_PLUS, KC_RCBR, KC_PIPE, \
M(PSCREEN_APP), KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_1, KC_2, KC_3, KC_BSLS, KC_VOLD, KC_VOLU, \
KC_PSCR, _______, _______, _______, _______, _______, KC_0, KC_DOT, KC_EQL, KC_MPRV, KC_MNXT, KC_MPLY \
[SYMB] = KEYMAP( \
KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, \
_______, KC_EXLM, KC_AT, KC_LPRN, KC_RPRN, KC_PIPE, KC_7, KC_8, KC_9, KC_ASTR, KC_RPRN, KC_F12, \
_______, KC_HASH, KC_DLR, KC_LCBR, KC_RCBR, KC_GRV, KC_4, KC_5, KC_6, KC_PLUS, KC_RCBR, KC_PIPE, \
M(PSCREEN_APP), KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_1, KC_2, KC_3, KC_BSLS, KC_VOLD, KC_VOLU, \
KC_PSCR, _______, _______, _______, _______, TG(GAME), KC_0, KC_DOT, KC_EQL, KC_MPRV, KC_MNXT, KC_MPLY \
),

/* Vim Movement (Hold down F)
* ,-----------------------------------------------------------------------------------.
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* | | | | LSHFT| | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | DLeft|DRight| LCTRL| | | Left | Down | Up | Right| | |
* | | DLeft|DRight| LCTRL| LGUI | | Left | Down | Up | Right| | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | LShft| | | | | | | |
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_VIM] = KEYMAP( \
[VIM] = KEYMAP( \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, M(DLEFT), M(DRIGHT), KC_LCTL, KC_LGUI, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, M(DLEFT), M(DRIGHT), KC_LCTL, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, KC_LSFT, _______, _______, _______, _______, _______, _______, _______ \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),

/* Gaming mode (Raise)
Expand All @@ -98,12 +96,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Enter| | Lock | Bksp | Alt | Spc | Lower| Left | Up | Down | Right|QWERTY|
* `-----------------------------------------------------------------------------------'
*/
[_GAME] = KEYMAP( \
[GAME] = KEYMAP( \
KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
KC_LCTL, _______, _______, _______, KC_F, _______, _______, _______, _______, _______, _______, _______, \
KC_LSFT, KC_Z, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LGUI, \
KC_ENT, _______, KC_LOCK, KC_BSPC, KC_LALT, KC_SPC, OSL(_LOWER), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, TO(_QWERTY) \
KC_ENT, _______, KC_LOCK, KC_BSPC, KC_LALT, KC_SPC, OSL(SYMB), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, TO(BASE) \
)

};
Expand Down Expand Up @@ -133,3 +131,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
}
return MACRO_NONE;
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
tap_dance_process_record(keycode);
return true;
}
3 changes: 2 additions & 1 deletion keyboards/nyquist/keymaps/333fred/rules.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
KEY_LOCK_ENABLE = yes
NKRO_ENABLE = yes
CONSOLE_ENABLE = yes
CONSOLE_ENABLE = no
TAP_DANCE_ENABLE = yes

ifndef QUANTUM_DIR
include ../../../../Makefile
Expand Down
23 changes: 10 additions & 13 deletions layouts/community/ergodox/333fred/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@
,--------------------------------------------------. ,--------------------------------------------------.
| ` | 1 | 2 | 3 | 4 | 5 | = | | L1 | 6 | 7 | 8 | 9 | 0 | - |
|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
| TAB | Q | W | E | R | T | L2 | | L2 | Y | U | I | O | P | \ |
| TAB | Q | W | E | R | T | L1 | | L2 | Y | U | I | O | P | \ |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| Esc | A | S | D |LT 3,F| G |------| |------| H | J | K | L |; / : | ' |
|--------+------+------+------+------+------| L1 | |TT(3) |------+------+------+------+------+--------|
| Esc | A | S | D | F | G |------| |------| H | J | K | L | ; | ' |
|--------+------+------+------+------+------| L2 | |TT(3) |------+------+------+------+------+--------|
| LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
|LCTRL | F4 | F5 | LGUI | LALT | | Left | Down | Up | Right| RGUI |
`----------------------------------' `----------------------------------'
,-------------. ,-------------.
| Copy | Paste| | Alt |Ctrl/Esc|
| Copy | Paste| | Copy | Paste |
,------|------|------| |------+--------+------.
| | | PgUp | | PgDn | | |
| Bcksp|OSL(2)|------| |------| Ent |Space |
| | | Del | |OSL(2)| | |
| | VIM | Del | |OSL(2)| | |
`--------------------' `----------------------'
```
* Double-click `;` to get a `:`
* Press-and-hold `f` to go to the movement layer
* For a single tap or single hold, OSL behaves like OSL(SYMB). For a tap + hold, it behaves like MO(VIM).

### Keymap 1: Code Layer
```
Expand All @@ -38,21 +37,19 @@
| | | | | | | F12 |GoToIm| FAR | | |
`----------------------------------' `----------------------------------'
,-------------. ,---------------.
|Format|Build | | Test | DTest |
|Format|Build | | Copy | Paste |
,------|------|------| |------+--------+------.
| | |Refact| |Sort U| | |
| | |------| |------| | |
| | | | | | | |
`--------------------' `----------------------'
```
* Build - Visualt Studio Build Solution. Sends `CTRL + SHFT + B`
* DTest - Visual Studio Debug Test. Sends `CTRL + R, CTRL + T`
* FAR - Visual Studio Find All References. Sends `CTRL + K, R`
* Format - Visual Studio Format. Sends `CTRL + K, CTRL + D`
* GoToIm - Visual Studio Go To Implementation. Sends `CTRL + F12`
* Refact - Visual Studio Refactor. Sends `CTRL + R, R`
* Sort U - Visual Studio Sort Usings. Sends `CTRL + R, CTRL + G`
* Test - Visual Studio Run Test. Sends `CTRL + R, T`


### Keymap 2: Symbol Layer
Expand Down Expand Up @@ -105,9 +102,9 @@
,--------------------------------------------------. ,--------------------------------------------------.
| | | | | | | | | | | | | | | |
|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
| |KOpen |KType | | | | | | | Copy | | | | Paste| |
| |KOpen |KType | LSFT | | | | | | Copy | | | | Paste| |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| |DLeft |DRight| LCTL | | |------| |------| Left | Down | Up | Right| | |
| |DLeft |DRight| LCTL | LGUI | |------| |------| Left | Down | Up | Right| | |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| |SFT_TB| Tab | | | | | | | | | | | | |
`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
Expand All @@ -117,7 +114,7 @@
| | | | Home | End |
,------|------|------| |------+------+------.
| | | | | | | |
| | LSFT |------| |------| | |
| | |------| |------| | |
| | | | | | | |
`--------------------' `--------------------'
```
Expand Down
Loading

0 comments on commit 89357b9

Please sign in to comment.