Merge pull request #781 from cbbrowne/master

Recent enhancements to keyboard map
pull/786/head
Jack Humbert 8 years ago committed by GitHub
commit 628c5bcc62

@ -3,6 +3,9 @@
#include "../../config.h"
#define LEADER_TIMEOUT 300
#define BACKLIGHT_BREATHING
/* cbbrowne user configuration */
#define randadd 53
@ -16,5 +19,3 @@
#endif

@ -65,10 +65,11 @@
*/
enum layers {
_QW = 0, /* Qwerty mapping */
_LW, /* Lower layer, where top line has symbols !@#$%^&*() */
_RS, /* Raised layer, where top line has digits 1234567890 */
_KP, /* Key pad */
_QWERTY = 0, /* Qwerty mapping */
_LOWER, /* Lower layer, where top line has symbols !@#$%^&*() */
_RAISE, /* Raised layer, where top line has digits 1234567890 */
_KEYPAD, /* Key pad */
_ADJUST, /* Special Adjust layer coming via tri-placement */
};
enum macro_id {
@ -76,37 +77,60 @@ enum macro_id {
M_USERNAME,
M_RANDDIGIT,
M_RANDLETTER,
M_VERSION
M_VERSION,
MACRO_UPPER,
MACRO_LOWER,
};
#define M_LOWER M(MACRO_LOWER)
#define M_UPPER M(MACRO_UPPER)
#define ROT_LED M(M_LED) /* Rotate LED */
#define QWERTY DF(_QWERTY) /* Switch to QWERTY layout */
#define KEYPAD DF(_KEYPAD) /* Switch to keypad */
#define USERNAME M(M_USERNAME) /* shortcut for username */
#define RANDDIG M(M_RANDDIGIT)
#define RANDALP M(M_RANDLETTER)
#define CTLENTER MT(MOD_RCTL, KC_ENT)
#define SHIFTQUOTE MT(MOD_RSFT, KC_QUOT)
#define ALTRIGHT MT(MOD_LALT, KC_RGHT)
#define MVERSION M(M_VERSION)
/* Note that Planck has dimensions 4 rows x 12 columns */
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QW] = { /* Qwerty */
[_QWERTY] = { /* Qwerty */
{KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, MT(MOD_RSFT, KC_ENT)},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT },
{KC_TAB, M(M_LED), KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
{KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, CTLENTER},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SHIFTQUOTE },
{KC_TAB, KC_LALT, ROT_LED, KC_LGUI, M_LOWER, KC_SPC, KC_SPC, M_UPPER, KC_LEFT, KC_DOWN, KC_UP, ALTRIGHT}
/* Note that KC_SPC is recorded TWICE, so that either matrix position can activate it */
},
[_RS] = { /* RAISE */
[_RAISE] = { /* 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_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_KP), DF(_KP), RESET, _______},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, QWERTY, KEYPAD, KEYPAD, RESET, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
[_LW] = { /* LOWER */
[_LOWER] = { /* LOWER */
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_KP), DF(_KP), RESET, _______},
{_______, DF(_KP), _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, QWERTY, KEYPAD, KEYPAD, RESET, _______},
{_______, KEYPAD, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
[_KEYPAD] = { /* Key Pad */
{KC_ESC, USERNAME, MVERSION, KC_F10, KC_F11, KC_F12, KC_PGUP, KC_KP_ENTER, KC_7, KC_8, KC_9, KC_BSPC},
{KC_LCTL, RANDDIG, KC_F5, KC_F6, KC_F7, KC_F8, KC_PGDN, KC_KP_MINUS, KC_4, KC_5, KC_6, KC_PIPE},
{KC_LSFT, RANDALP, KC_F1, KC_F2, KC_F3, KC_F4, KC_DEL, KC_KP_PLUS, KC_1, KC_2, KC_3, KC_ENTER},
{KC_TAB, KC_LALT, ROT_LED, KC_LGUI, M_LOWER, KC_SPC, KC_SPC, QWERTY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT}
},
[_KP] = { /* Key Pad */
{KC_ESC, M(M_USERNAME), M(M_VERSION), KC_F10, KC_F11, KC_F12, KC_PGUP, KC_KP_ENTER, KC_7, KC_8, KC_9, KC_BSPC},
{KC_LCTL, M(M_RANDDIGIT), KC_F5, KC_F6, KC_F7, KC_F8, KC_PGDN, KC_KP_MINUS, KC_4, KC_5, KC_6, KC_PIPE},
{KC_LSFT, M(M_RANDLETTER), KC_F1, KC_F2, KC_F3, KC_F4, KC_DEL, KC_KP_PLUS, KC_1, KC_2, KC_3, KC_ENTER},
{BL_STEP, M(M_LED), KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, DF(_QW), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT}
}
[_ADJUST] = { /* Adjustments - gonna shift the wild tools in here */
{ROT_LED,USERNAME,MVERSION, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{_______, RANDDIG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{_______, RANDALP, _______, _______, _______, RESET, RESET, _______, _______, _______, _______, _______ },
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }
}
};
/* What is fn_actions actually used for??? */
@ -171,6 +195,39 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
unregister_code (KC_A + rval);
}
break;
case MACRO_UPPER:
if (record->event.pressed)
{
layer_on(_RAISE);
#ifdef BACKLIGHT_ENABLE
breathing_speed_set(2);
breathing_pulse();
#endif
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
else
{
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
break;
case MACRO_LOWER:
if (record->event.pressed)
{
layer_on(_LOWER);
#ifdef BACKLIGHT_ENABLE
breathing_speed_set(2);
breathing_pulse();
#endif
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
else
{
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
break;
}
return MACRO_NONE;
};

@ -24,7 +24,26 @@ doing sundry experimentation:
- Key [2][2] aka "a" uses a random number generator to select a digit 0-9 at random
- Key [3][2] aka "z" uses a random number generator to select a letter a-z at random
- Key [1][3] aka "e" spits out the keymap version number
* Minor use of Space Cadet Shift; my SHIFT key has switched to KC_LSP0, so that when I just hit SHIFT, I get a left parens: ( which is great for Lisping. I don't have a Right Shift, so I don't get an autoclose; I think I'll live with that until a Planck successor with more lines of keys :-)
* Trying out sgoodwin's "hold Enter down to get Shift"
- Liking this Quite Well Enough...
- Applied this to both Shift and Quote
- It seems likely that Alt should get a right-hand-side, akin to this...
- Alt needs to move, and get a RHS
- Hence ALTRIGHT, and shifted ROT_LED over
- Emacs likes this!!! :-)
- I'm suspicious that I'll want to shift ROT_LED another location over,
so some modifier can replace the OS/KC_LGUI key
* I have added an alternate ADJUST layer that is activated via update_tri_layer()
- e.g. - LOWER+RAISE simultaneously
- This seems entirely more useful for handling my "special keys"
like the random numbers, user name, and such, than the keypad layer
* The _ADJUST layer provides a good place to have RESET
- But this isn't strictly enough; I want RESET somewhat accessible from
main layer lest an error hide that layer
- I never use the OS/KC_LGUI key (that's Command on MacOS, Windows
Key on Windows), so that's a good place to have it as a chord of
some sort
2. Some code structure ideas
---------------------------------------------------
@ -43,8 +62,8 @@ doing sundry experimentation:
only need to fit 4 symbols onto each line, rather than 12.
I used enums to manage layer IDs and macro IDs so that I don't need
to care (beyond "start at 0", and arguably that's not needed) about
their values.
to care (beyond "start at 0", and arguably even that's not needed)
about their values.
3. Things I did not like about the default mapping
---------------------------------------------------------
@ -57,12 +76,27 @@ doing sundry experimentation:
and shift ESC off the first column so KC_LCTL and KC_LALT can
be on the first column.
* I needed to swap ' and ENTER
4. Unuseful experiments
---------------------------------------------------------
I have tried some things out that didn't turn out particularly well.
I'll note some of these for posterity, hopefully helpful in not doing
unwise things again...
* I tried added Workman alongside Dvorak and Colemak
- Boy, oh boy, these don't help!!!
- I have done 30 years of learning of Emacs key mappings, and
these alternative keyboards massively mess me up
4. TODO
* Space Cadet Shift; switching L_SHIFT to KC_LSP0, so that when I
just hit SHIFT, I get a left parens. In principle, this is great
for Lisping.
- Unfortunately, there are times when mouse interfaces use SHIFT
to allow selecting multiple items, and this really interferes
with that
5. TODO
---------------------------------------------------------
* I use tmux quite a lot; the mollat keymap seems to have some
@ -77,4 +111,3 @@ doing sundry experimentation:
* The jeebak keymap seems to have some neat ideas:
- Number layer which is aggressive about having numbers in several places
- Touch layer seems interesting
* Trying out sgoodwin's "hold Enter down to get Shift"
Loading…
Cancel
Save