1
0
Fork 0

Split fn layer from numbers layer to better match the TM behaviour

- removed access to layer 2 from ";" key
- "fn" key toggles both layers 1 & 2
- replaced media and mouse layer by fn layer
- renamed symbol layer to numbers layer
- moved all F-keys together on left hand
This commit is contained in:
Didier Loiseau 2016-01-09 17:47:26 +01:00
parent 38a0e62a10
commit bfda6ee417

View file

@ -10,11 +10,12 @@
* - ] is moved in place of the dash (-)
* - dash (-) and = are moved on bottom right row
* - arrows and PgUp/PgDn are moved on the thumbs
* Layer 1: "Fn"-layer close to the TM with the following differences:
* - provides access to F1-F12
* - VolUp & VolDn are only on left hand
* - arrows & numpad are displaced by 1 to the top left
* Layer 2: TODO -- currently kept as in the default ErgoDox EZ layout
* Layer 1: numbers layer close to the TM when toggling "num" with the following differences:
* - numpad is displaced by 1 to the top left
* - arrows are displaced by 1 to the left
* - provides access to F1-F12, caps lock and num lock
* Layer 2: "fn" layer ("fn" key toggles both layers 1 & 2) with the following differences:
* - VolUp & VolDn are only on left hand to keep access to arrows on right hand
* Leds:
* - left (1st) & middle (2nd) leds are used to indicate layers 1 & 2 respectively
* - right (3rd) led is used to indicate caps-lock
@ -25,8 +26,8 @@
#include "led.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols
#define MDIA 2 // media keys
#define NMBR 1 // numbers layer
#define FNLR 2 // fn layer
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
@ -36,11 +37,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T |Backsp| |Backsp| Y | U | I | O | P | [ |
* |--------+------+------+------+------+------|ace | |ace |------+------+------+------+------+--------|
* | LShift | A | S | D | F | G |------| |------| H | J | K | L |; / L2| '/Shift|
* | LShift | A | S | D | F | G |------| |------| H | J | K | L | ; | '/Shift|
* |--------+------+------+------+------+------|Enter | |Enter |------+------+------+------+------+--------|
* | LShift | Z | X | C | V | B | | | | N | M | , | . | / | \/Shift|
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |LCtrl | ~L1 | LGui | Play |App/Alt| | RAlt | - | Home | = |End/Ctl|
* |LCtrl | fn | LGui | Play |App/Alt| | RAlt | - | Home | = |End/Ctl|
* `-----------------------------------' `-----------------------------------'
* ,--------------. ,-------------.
* |Esc/Alt| L1 | | Left |Right |
@ -58,56 +59,56 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_BSPC,
KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ENT,
KC_LCTL, KC_FN1, KC_LGUI,KC_MPLY,ALT_T(KC_APP),
KC_LCTL, M(2), KC_LGUI,KC_MPLY,ALT_T(KC_APP),
ALT_T(KC_ESC), TG(1),
KC_PGUP,
KC_SPC, KC_SPC, KC_PGDN,
// right hand
KC_DELT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_RBRC,
KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,
KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),SFT_T(KC_QUOT),
KC_ENT, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, SFT_T(KC_BSLS),
KC_RALT,KC_MINS,KC_HOME,KC_EQL, CTL_T(KC_END),
KC_DELT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_RBRC,
KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, SFT_T(KC_QUOT),
KC_ENT, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_BSLS),
KC_RALT, KC_MINS, KC_HOME, KC_EQL, CTL_T(KC_END),
KC_LEFT, KC_RGHT,
KC_UP,
KC_DOWN, KC_SPC, KC_SPC
),
/* Keymap 1: Symbol Layer
/* Keymap 1: Numbers Layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | F1 | F2 | F3 | F4 | F5 |Insert| |Insert| F6 | F7 | Tab | / | * | - |
* | | F1 | F2 | F3 | F4 | F5 | | | | | | Tab | / | * | - |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | F8 | F9 | F10 | F11 | F12 |VolUp | | | | Home | 7 | 8 | 9 | + |
* | | F6 | F7 | F8 | F9 | F10 | | | | | Home | 7 | 8 | 9 | + |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | |------| |------| Up | End | 4 | 5 | 6 | + |
* |--------+------+------+------+------+------|VolDn | | |------+------+------+------+------+--------|
* | | | cut | copy |paste | Mute | | | Left | Down | Right| 1 | 2 | 3 |KpEnter |
* | | F11 | F12 | | | |------| |------| Up | End | 4 | 5 | 6 | + |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | Left | Down | Right| 1 | 2 | 3 |KpEnter |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | 0 | 00 | . |Etr/Ctl|
* `----------------------------------' `-----------------------------------'
* ,-------------. ,-------------.
* | | | |n.lock|c.lock|
* ,------|------|------| |------+------+------.
* | | | | | Next | | |
* | Mute | |------| |------| | |
* | | | | | Prev | | |
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// SYMBOLS
[SYMB] = KEYMAP(
[NMBR] = KEYMAP(
// left hand
KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_INS,
KC_TRNS,KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLU,
KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS,KC_TRNS,LSFT(KC_DELT),LCTL(KC_INS),LSFT(KC_INS),KC_MUTE,KC_VOLD,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS,
KC_TRNS, KC_F11, KC_F12, 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,
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_MUTE, KC_TRNS,KC_TRNS,
KC_TRNS, KC_TRNS,KC_TRNS,
// right hand
KC_INS, KC_F6, KC_F7, KC_TAB, KC_PSLS, KC_PAST, KC_PMNS,
KC_TRNS, KC_TRNS, KC_HOME, KC_P7, KC_P8, KC_P9, KC_PPLS,
@ -116,73 +117,77 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_P0, M(1), KC_PDOT, CTL_T(KC_PENT),
KC_NLCK, KC_CAPS,
KC_MPRV,
KC_MNXT, KC_TRNS, KC_TRNS
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
/* Keymap 2: Media and mouse keys
/* Keymap 2: fn layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | | | | |
* | | | | | | |Insert| |Insert| | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | MsUp | | | | | | | | | | | |
* | | | | | | |VolUp | | | | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
* | | | | | | |------| |------| | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | Prev | Next | | |
* | | | cut | copy |paste | Mute |VolDn | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | |Brwser|
* | | |------| |------| |Back |
* | | | | | | | |
* | | | | | Next | | |
* | Mute | |------| |------| | |
* | | | | | Prev | | |
* `--------------------' `--------------------'
*/
// MEDIA AND MOUSE
KEYMAP(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
[FNLR] = KEYMAP(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, LSFT(KC_DELT),LCTL(KC_INS),LSFT(KC_INS), KC_MUTE, KC_VOLD,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
KC_MUTE, KC_TRNS, KC_TRNS,
// right hand
KC_INS, 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, 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, KC_TRNS, KC_MPLY,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
KC_VOLU, KC_VOLD, KC_MUTE, 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_WBAK
KC_MPRV,
KC_MNXT, KC_TRNS, KC_TRNS
),
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
switch(id) {
case 0:
if (record->event.pressed) {
register_code(KC_RSFT);
} else {
unregister_code(KC_RSFT);
}
if (record->event.pressed) {
register_code(KC_RSFT);
} else {
unregister_code(KC_RSFT);
}
break;
case 1:
if (record->event.pressed) {
return MACRO( I(25), T(P0), T(P0), END );
}
if (record->event.pressed) {
return MACRO( I(25), T(P0), T(P0), END );
}
break;
}
case 2:
layer_state ^= (1 << NMBR) | (1 << FNLR);
break;
}
return MACRO_NONE;
};
@ -194,24 +199,19 @@ void * matrix_init_user(void) {
// Runs constantly in the background, in a loop.
void * matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
// TODO: Make this relevant to the ErgoDox EZ.
case 1:
ergodox_right_led_1_on();
break;
case 2:
ergodox_right_led_2_on();
break;
default:
// none
break;
// led 1: numbers layer
if (layer_state & (1 << NMBR)) {
ergodox_right_led_1_on();
}
// led 2: fn layer
if (layer_state & (1 << FNLR)) {
ergodox_right_led_2_on();
}
// led 3: caps lock
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) {
ergodox_right_led_3_on();
}