forked from forks/qmk_firmware
[Jack & Erez] Simplifies and documents TO
This commit is contained in:
parent
698d02122b
commit
e27a754b70
|
@ -38,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_H,
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_H,
|
||||||
CTL_T(KC_GRV),KC_NUBS,KC_NO, KC_NO, KC_LALT,
|
CTL_T(KC_GRV),KC_NUBS,KC_NO, KC_NO, KC_LALT,
|
||||||
KC_PSCREEN, KC_PSCREEN,
|
KC_PSCREEN, KC_PSCREEN,
|
||||||
TO(PROG, ON_PRESS),
|
TO(PROG),
|
||||||
KC_SPC, MO(NAVI), KC_LGUI,
|
KC_SPC, MO(NAVI), KC_LGUI,
|
||||||
// right hand
|
// right hand
|
||||||
KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_BSPC,
|
KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_BSPC,
|
||||||
|
@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT,
|
KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT,
|
||||||
KC_RALT,KC_LBRC,KC_RBRC,KC_NO, CTL_T(KC_QUOT),
|
KC_RALT,KC_LBRC,KC_RBRC,KC_NO, CTL_T(KC_QUOT),
|
||||||
MT(0x5, KC_NO), MT(0x5, KC_NO),
|
MT(0x5, KC_NO), MT(0x5, KC_NO),
|
||||||
TO(PROG, ON_PRESS),
|
TO(PROG),
|
||||||
KC_RGUI, MO(PROG), KC_SPC
|
KC_RGUI, MO(PROG), KC_SPC
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
KC_TRNS, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_TRNS,
|
KC_TRNS, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS,
|
||||||
TO(NAVI, ON_PRESS),
|
TO(NAVI),
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
// right hand
|
// right hand
|
||||||
KC_TRNS, KC_TRNS, KC_NO, KC_PSLS, KC_PAST, KC_PMNS, KC_EQUAL,
|
KC_TRNS, KC_TRNS, KC_NO, KC_PSLS, KC_PAST, KC_PMNS, KC_EQUAL,
|
||||||
|
@ -90,7 +90,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PENT, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PENT, KC_TRNS,
|
||||||
KC_P0, KC_P0, KC_PDOT, KC_PENT, KC_TRNS,
|
KC_P0, KC_P0, KC_PDOT, KC_PENT, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS,
|
||||||
TO(NAVI, ON_PRESS),
|
TO(NAVI),
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS
|
KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
|
KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS,
|
||||||
TO(BASE, ON_PRESS),
|
TO(BASE),
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
// right hand
|
// right hand
|
||||||
KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS,
|
KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS,
|
||||||
|
@ -132,7 +132,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
KC_TRNS, KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_TRNS,
|
||||||
KC_VOLD, KC_MUTE, KC_VOLU, KC_TRNS, KC_TRNS,
|
KC_VOLD, KC_MUTE, KC_VOLU, KC_TRNS, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS,
|
||||||
TO(BASE, ON_PRESS),
|
TO(BASE),
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS
|
KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
|
@ -296,7 +296,10 @@ enum quantum_keycodes {
|
||||||
// ON_PRESS = 1
|
// ON_PRESS = 1
|
||||||
// ON_RELEASE = 2
|
// ON_RELEASE = 2
|
||||||
// Unless you have a good reason not to do so, prefer ON_PRESS (1) as your default.
|
// Unless you have a good reason not to do so, prefer ON_PRESS (1) as your default.
|
||||||
#define TO(layer, when) (layer | QK_TO | (when << 0x4))
|
// In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own
|
||||||
|
// keycode modeled after the old version, kept below for this.
|
||||||
|
/* #define TO(layer, when) (layer | QK_TO | (when << 0x4)) */
|
||||||
|
#define TO(layer) (layer | QK_TO | (ON_PRESS << 0x4))
|
||||||
|
|
||||||
// Momentary switch layer - 256 layer max
|
// Momentary switch layer - 256 layer max
|
||||||
#define MO(layer) (layer | QK_MOMENTARY)
|
#define MO(layer) (layer | QK_MOMENTARY)
|
||||||
|
|
|
@ -379,6 +379,8 @@ Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` -
|
||||||
|
|
||||||
`TG(layer)` - toggles a layer on or off. As with `MO()`, you should set this key as `KC_TRNS` in the destination layer so that tapping it again actually toggles back to the original layer. Only works upwards in the layer stack.
|
`TG(layer)` - toggles a layer on or off. As with `MO()`, you should set this key as `KC_TRNS` in the destination layer so that tapping it again actually toggles back to the original layer. Only works upwards in the layer stack.
|
||||||
|
|
||||||
|
`TO(layer)` - Goes to a layer. This code is special, because it lets you go either up or down the stack -- just goes directly to the layer you want. So while other codes only let you go _up_ the stack (from layer 0 to layer 3, for example), `TO(2)` is going to get you to layer 2, no matter where you activate it from -- even if you're currently on layer 5. This gets activated on keydown (as soon as the key is pressed).
|
||||||
|
|
||||||
|
|
||||||
### Fun with modifier keys
|
### Fun with modifier keys
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue