#include QMK_KEYBOARD_H #include "keymap_extras/keymap_neo2.h" /* * audax_osx (Planck) - neo2 for macOS via the *software* neo2 keyboard layout. * * Planck counterpart of the ergodox `audax_osx` layout, and a modernised * rewrite of the old `planck/keymaps/audax` (which used the long-removed * fn_actions / action_get_macro API and no longer builds). * * The base layer and Mod3 send positional NE_* scancodes; the OS neo2 layout * (neo2-layout-osx .keylayout) produces the characters. Numbers, function keys * and the cursor block live on firmware layers (_RS / _LW) with real keycodes, * so they auto-repeat. See layouts/community/ergodox/audax_osx/readme.md for * the macOS / Karabiner setup. * * Mod3 (layer 3, symbols) is held on the '#' key (NE_L3R / KC_NUHS) on both * Mod3 positions - macOS intercepts CapsLock, so the canonical neo2 Mod3-left * (NE_L3L) is not used. The right Mod3 key taps to ss (neo2 sharp-s); '@' is * Mod3 + y. */ enum planck_layers { _NE, // neo2 base (positional scancodes) _RS, // raise: numbers, function and media keys _LW // lower: cursor block, numbers, ss and shortcuts }; enum custom_keycodes { NEO_L3R_SS = SAFE_RANGE, // right Mod3: hold = Mod3 ('#'), tap = ss (sharp-s) NEO_AT // @ (neo2 Mod3 + y) }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* _NE: neo2 base * ,-----------------------------------------------------------------------------------. * | Tab | X | V | L | C | W | K | H | G | F | Q | Y | * |------+------+------+------+------+------+------+------+------+------+------+-------| * | Mod3 | U | I | A | E | O | S | N | R | T | D |Mod3/ß | * |------+------+------+------+------+------+------+------+------+------+------+-------| * | Shift| Ü | Ö | Ä | P | Z | B | M | , | . | J |Sft/Esc| * |------+------+------+------+------+------+------+------+------+------+------+-------| * | GUI | Alt | PgUp | PgDn |Lower | Space| Enter| Ctrl | Alt | Del | Bksp |Raise | * `-----------------------------------------------------------------------------------' */ [_NE] = LAYOUT_planck_grid( KC_TAB, NE_X, NE_V, NE_L, NE_C, NE_W, NE_K, NE_H, NE_G, NE_F, NE_Q, NE_Y, NE_L3R, NE_U, NE_I, NE_A, NE_E, NE_O, NE_S, NE_N, NE_R, NE_T, NE_D, NEO_L3R_SS, KC_LSFT, NE_UDIA, NE_ODIA, NE_ADIA, NE_P, NE_Z, NE_B, NE_M, NE_COMM, NE_DOT, NE_J, RSFT_T(KC_ESC), KC_LGUI, KC_LALT, KC_PGUP, KC_PGDN, MO(_LW), KC_SPC, KC_ENT, KC_LCTL, KC_LALT, KC_DEL, KC_BSPC, MO(_RS) ), /* _RS: raise - numbers, function keys, media * ,-----------------------------------------------------------------------------------. * | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | * |------+------+------+------+------+------+------+------+------+------+------+-------| * | | F1 | F2 | F3 | F4 | F5 | F6 | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+-------| * | | F7 | F8 | F9 | F10 | F11 | F12 | ->NE | Next | Prev | Boot | | * |------+------+------+------+------+------+------+------+------+------+------+-------| * | | | | | | | | Play | Vol- | Vol+ | | * `-----------------------------------------------------------------------------------' */ [_RS] = LAYOUT_planck_grid( KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, _______, _______, _______, _______, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_NE), KC_MNXT, KC_MPRV, QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_VOLD, KC_VOLU, _______ ), /* _LW: lower - cursor block (left), numbers (right), ss, shortcuts * ,-----------------------------------------------------------------------------------. * | | PgUp | Del | Up | Bksp | PgDn | 0 | 1 | 2 | 3 | ß | @ | * |------+------+------+------+------+------+------+------+------+------+------+-------| * | | Home | Left | Down | Right| End | ^ | 4 | 5 | 6 |A(Tab)| | * |------+------+------+------+------+------+------+------+------+------+------+-------| * | | | | | | PgDn | | 7 | 8 | 9 |G(S(Q))| | * |------+------+------+------+------+------+------+------+------+------+------+-------| * | | | | | | | | | | |S(Ins) | * `-----------------------------------------------------------------------------------' */ [_LW] = LAYOUT_planck_grid( _______, KC_PGUP, KC_DEL, KC_UP, KC_BSPC, KC_PGDN, KC_0, KC_1, KC_2, KC_3, NE_SS, NEO_AT, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, KC_GRV, KC_4, KC_5, KC_6, LALT(KC_TAB), _______, _______, _______, _______, _______, _______, KC_PGDN, _______, KC_7, KC_8, KC_9, LGUI(S(NE_Q)), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, S(KC_INS) ) }; // Tap/hold state for the right Mod3 key (tap = ss, hold = Mod3 / '#'). static bool l3r_held = false; static bool l3r_used = false; bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case NEO_L3R_SS: if (record->event.pressed) { register_code(NE_L3R); // '#' -> neo2 Mod3 while held l3r_held = true; l3r_used = false; } else { unregister_code(NE_L3R); l3r_held = false; if (!l3r_used) { tap_code(NE_SS); // pure tap -> ss (neo2 sharp-s) } } return false; case NEO_AT: // @ = neo2 Mod3 ('#') + y, held together so it repeats while pressed. if (record->event.pressed) { register_code(NE_L3R); register_code(NE_Y); } else { unregister_code(NE_Y); unregister_code(NE_L3R); } return false; default: // A separate key pressed while Mod3 is held means it is being used as a // modifier, so the release must not emit the tap ('y'). if (record->event.pressed && l3r_held) { l3r_used = true; } break; } return true; }