Created
August 9, 2015 00:23
-
-
Save drewbaumann/ed78c65ef73357822510 to your computer and use it in GitHub Desktop.
DB Mod HHKB keymap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* HHKB Layout - DB Mod | |
*/ | |
#include "keymap_common.h" | |
#ifdef KEYMAP_SECTION_ENABLE | |
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { | |
#else | |
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |
#endif | |
/* Layer 0: Default Layer | |
* ,-----------------------------------------------------------. | |
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `| | |
* |-----------------------------------------------------------| | |
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs| | |
* |-----------------------------------------------------------| | |
* |Contro| A| S| D| F| G| H| J| K| L| Fn1| '|Enter | | |
* |-----------------------------------------------------------| | |
* |Fn3 | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0| | |
* `-----------------------------------------------------------' | |
* |Alt|Gui | Space |Gui |Fn2| | |
* `-------------------------------------------' | |
*/ | |
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \ | |
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ | |
LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT,ENT, \ | |
FN3, Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \ | |
LALT,LGUI, SPC, RGUI,FN2), | |
/* Layer 1: HHKB mode (HHKB Fn) | |
* ,-----------------------------------------------------------. | |
* |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| | |
* |-----------------------------------------------------------| | |
* |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| | |
* |-----------------------------------------------------------| | |
* | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | | |
* |-----------------------------------------------------------| | |
* | | | | | | | +| -|End|PgD|Dow| | | | |
* `-----------------------------------------------------------' | |
* | | | | | | | |
* `-------------------------------------------' | |
*/ | |
KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | |
CAPS,MRWD,MPLY,MFFD,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC, \ | |
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \ | |
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS, \ | |
TRNS,TRNS, TRNS, TRNS,RALT), | |
/* 2: Mousekey | |
* ,-----------------------------------------------------------. | |
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| | |
* |-----------------------------------------------------------| | |
* |Tab | |McU| | | | |MwD| | | | | |Backs| | |
* |-----------------------------------------------------------| | |
* |Contro|McL|McD|McR|SP2| |MwR|Mb1|Mb2|MwL| | |Return | | |
* |-----------------------------------------------------------| | |
* |Shift | | | | | |MwU| | | | |Shift | | | |
* `-----------------------------------------------------------' | |
* |Gui |Alt |Mb1 |Alt | | | |
* `--------------------------------------------' | |
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel / SP: speed lvl | |
*/ | |
KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | |
TAB, TRNS,MS_U,TRNS,TRNS,TRNS,TRNS,WH_D,TRNS,TRNS,TRNS,TRNS,TRNS,BSPC, \ | |
LCTL,MS_L,MS_D,MS_R,ACL2,TRNS,WH_R,BTN1,BTN2,WH_L,TRNS,QUOT,ENT, \ | |
LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,WH_U,TRNS,TRNS,SLSH,RSFT,TRNS, \ | |
LALT,LGUI, BTN1, RGUI,TRNS), | |
}; | |
/* id for user defined functions */ | |
enum function_id { | |
LSHIFT_LPAREN, | |
}; | |
/* | |
* Fn action definition | |
*/ | |
const uint16_t fn_actions[] PROGMEM = { | |
[0] = ACTION_LAYER_MOMENTARY(1), // FN0 | |
[1] = ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN1 | |
[2] = ACTION_LAYER_TOGGLE(2), // FN2 | |
[3] = ACTION_FUNCTION_TAP(LSHIFT_LPAREN), | |
}; | |
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) | |
{ | |
if (record->event.pressed) dprint("P"); else dprint("R"); | |
dprintf("%d", record->tap.count); | |
if (record->tap.interrupted) dprint("i"); | |
dprint("\n"); | |
switch (id) { | |
case LSHIFT_LPAREN: | |
// Shift parentheses example: LShft + tap '(' | |
// http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#shift-parentheses | |
// http://geekhack.org/index.php?topic=41989.msg1304899#msg1304899 | |
if (record->event.pressed) { | |
if (record->tap.count > 0 && !record->tap.interrupted) { | |
if (record->tap.interrupted) { | |
dprint("tap interrupted\n"); | |
register_mods(MOD_BIT(KC_LSHIFT)); | |
} | |
} else { | |
register_mods(MOD_BIT(KC_LSHIFT)); | |
} | |
} else { | |
if (record->tap.count > 0 && !(record->tap.interrupted)) { | |
add_weak_mods(MOD_BIT(KC_LSHIFT)); | |
send_keyboard_report(); | |
register_code(KC_9); | |
unregister_code(KC_9); | |
del_weak_mods(MOD_BIT(KC_LSHIFT)); | |
send_keyboard_report(); | |
record->tap.count = 0; // ad hoc: cancel tap | |
} else { | |
unregister_mods(MOD_BIT(KC_LSHIFT)); | |
} | |
} | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is my keymap for the HHKB using Hasu's TMK firmware.
I have no idea if I will ever use the mouse functionality, but the ability to add a left parens by tapping shift is cool. I'm also happy to have all the useful media keys now on my HHKB. This makes the already terrific HHKB experience even better.