diff --git a/keyboards/planck/keymaps/audax_osx/config.h b/keyboards/planck/keymaps/audax_osx/config.h new file mode 100644 index 0000000000..d4b93cd1ab --- /dev/null +++ b/keyboards/planck/keymaps/audax_osx/config.h @@ -0,0 +1,5 @@ +#pragma once + +// Tap/hold window for RSFT_T(KC_ESC) and the right Mod3 tap-for-y key. +#undef TAPPING_TERM +#define TAPPING_TERM 200 diff --git a/keyboards/planck/keymaps/audax_osx/keymap.c b/keyboards/planck/keymaps/audax_osx/keymap.c new file mode 100644 index 0000000000..b65b451484 --- /dev/null +++ b/keyboards/planck/keymaps/audax_osx/keymap.c @@ -0,0 +1,130 @@ +#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; +} diff --git a/keyboards/planck/keymaps/audax_osx/readme.md b/keyboards/planck/keymaps/audax_osx/readme.md new file mode 100644 index 0000000000..9cb7b4d446 --- /dev/null +++ b/keyboards/planck/keymaps/audax_osx/readme.md @@ -0,0 +1,46 @@ +# audax_osx (Planck) - neo2 for macOS via the software neo2 layout + +Planck counterpart of the ergodox `audax_osx` layout, and a modern rewrite of +the old `planck/keymaps/audax` (which used the long-removed `fn_actions` / +`action_get_macro` API and no longer builds). + +Like the ergodox layout, it expects the **software neo2 keyboard layout** to be +installed on the Mac (see the full setup in +`layouts/community/ergodox/audax_osx/readme.md`): + +- Install [neo2-layout-osx](https://github.com/jgosmann/neo2-layout-osx) and + select it as the active input source. +- The base layer and Mod3 send positional `NE_*` scancodes; the OS neo2 layout + produces the characters. + +## Layers + +- **`_NE`** - neo2 base. Left/right Mod3 keys both hold `#` (`NE_L3R` / + `KC_NUHS`); macOS intercepts CapsLock, so the canonical Mod3-left (`NE_L3L`) + is not used. The right Mod3 key **taps to `ß`**; `@` (on `_LW`) is Mod3 + y. +- **`_RS`** (hold bottom-right) - number row, F-keys, media, `QK_BOOT`, and + `DF(_NE)` to reset the default layer. +- **`_LW`** (hold bottom-left) - cursor block on the left, numbers on the right, + `ß`, `@`, and a few macOS shortcuts. These are firmware keycodes, so the + cursor keys and numbers auto-repeat when held. + +## Building and flashing + +Built for a Massdrop/OLKB Planck **rev4** (atmega32u4, mini-USB, USB device +version 0.0.4, `atmel-dfu` bootloader): + +``` +qmk flash -kb planck/rev4 -km audax_osx +``` + +Put the board in the bootloader when prompted (physical RESET button on the +PCB; after this layout is flashed, `QK_BOOT` also lives on the `_RS` layer). The +keymap is revision-independent - substitute another target (`rev5`, `rev6`, +`rev6_drop`, ...) if you use a different Planck. + +## Notes + +- The right Mod3 tap emits `ß` (matching the ergodox `audax_osx`). The original + Planck `audax` tapped `y` here; `ß` was chosen instead since `y` already sits + on the base layer's top-right. +- The old `keyboards/planck/keymaps/audax` is left untouched. diff --git a/keyboards/planck/keymaps/audax_osx/rules.mk b/keyboards/planck/keymaps/audax_osx/rules.mk new file mode 100644 index 0000000000..2790548373 --- /dev/null +++ b/keyboards/planck/keymaps/audax_osx/rules.mk @@ -0,0 +1 @@ +BOOTMAGIC_ENABLE = no