~ruther/qmk_firmware

ff73cb6290271db473899118200a2fbf725cbc85 — theamarin 2 years ago 867e4fc
[Keymap] Add Neo2-based keymap for Planck keyboard (#19173)

Co-authored-by: christian <christian.lueke@sonoware.de>
A layouts/community/ortho_4x12/neo2marin/config.h => layouts/community/ortho_4x12/neo2marin/config.h +23 -0
@@ 0,0 1,23 @@
/* Copyright 2018-2022 TheAmarin (@theamarin)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

// Tune the tapping term for dual-use `y`/`MOD3` key
#define TAPPING_TERM 150

#define NO_ACTION_ONESHOT
#define NO_MUSIC_MODE

A layouts/community/ortho_4x12/neo2marin/keymap.c => layouts/community/ortho_4x12/neo2marin/keymap.c +175 -0
@@ 0,0 1,175 @@
/* Copyright 2018-2022 TheAmarin (@theamarin)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 
#include QMK_KEYBOARD_H
#include "keymap_german.h"

enum custom_keycodes {
  NEO2 = SAFE_RANGE,
  QWERTZ,
};

enum custom_layers {
  L_NEO,    // NEO2
  L_QWZ,    // QWERTZ
  L_COD,    // NEO2 Layer 3 (Coding layer using right MOD3)
  L_COD_AT, // NEO2 Layer 3 (Coding layer using left MOD3, with @)
  L_MOV,    // NEO2 Layer 4 (Movements)
  L_FUN,    // Function and media keys
};

#define MCOD MO(L_COD)
#define MCODAT MO(L_COD_AT)
#define MMOV MO(L_MOV)
#define MFUN MO(L_FUN)
#define YMCOD LT(L_COD, DE_Y)
#define AEMCOD MT(DE_HASH, DE_ADIA)
#define RALTF LM(L_FUN, MOD_RALT)

#define LALTTAB LALT(KC_TAB)
#define RALTTAB RALT(KC_TAB)
#define ME_MAXM LCTL(LGUI(KC_UP))

#if defined(SWAP_HANDS_ENABLE)
#define SWAPH SH_MON
#else
#define SWAPH KC_TRNS
#endif

#define ____ KC_TRNS

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

  [L_NEO] = LAYOUT_ortho_4x12(
  //,-------+-------+-------+-------+-------+-------.    ,-------+-------+-------+-------+-------+-------.
     KC_TAB , DE_X  , DE_V  , DE_L  , DE_C  , DE_W  ,      DE_K  , DE_H  , DE_G  , DE_F  , DE_Q  , DE_SS ,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
     MCODAT , DE_U  , DE_I  , DE_A  , DE_E  , DE_O  ,      DE_S  , DE_N  , DE_R  , DE_T  , DE_D  , YMCOD ,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
     KC_LSFT,DE_UDIA,DE_ODIA,DE_ADIA, DE_P  , DE_Z  ,      DE_B  , DE_M  ,DE_COMM, DE_DOT, DE_J  ,KC_RSFT,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
     KC_LCTL,KC_LGUI,KC_LALT, SWAPH , MFUN  , MMOV  ,    KC_SPACE, SWAPH , MFUN  , KC_APP, RALTF ,KC_RCTL
  //`-------+-------+-------+-------+-------+-------'    `-------+-------+-------+-------+-------+-------'
  ),

  [L_QWZ] = LAYOUT_ortho_4x12(
  //,-------+-------+-------+-------+-------+-------.    ,-------+-------+-------+-------+-------+-------.
     KC_TAB , DE_Q  , DE_W  , DE_E  , DE_R  , DE_T  ,      DE_Z  , DE_U  , DE_I  , DE_O  , DE_P  ,DE_UDIA,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
     KC_CAPS, DE_A  , DE_S  , DE_D  , DE_F  , DE_G  ,      DE_H  , DE_J  , DE_K  , DE_L  ,DE_ODIA,AEMCOD ,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
     KC_LSFT, DE_Y  , DE_X  , DE_C  , DE_V  , DE_B  ,      DE_N  , DE_M  ,DE_COMM, DE_DOT, DE_SS ,KC_RSFT,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
     KC_LCTL,KC_LGUI,KC_LALT, ____  , MFUN  , MMOV  ,    KC_SPACE, ____  ,KC_RALT,KC_APP , RALTF ,KC_RCTL
  //`-------+-------+-------+-------+-------+-------'    `-------+-------+-------+-------+-------+-------'
  ),

  [L_COD] = LAYOUT_ortho_4x12(
  //,-------+-------+-------+-------+-------+-------.    ,-------+-------+-------+-------+-------+-------.
     DE_ACUT,DE_EURO,DE_UNDS,DE_LBRC,DE_RBRC,DE_CIRC,     DE_EXLM,DE_LABK,DE_RABK,DE_EQL, DE_AMPR, DE_GRV,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  ,DE_BSLS,DE_SLSH,DE_LCBR,DE_RCBR,DE_ASTR,     DE_QUES,DE_LPRN,DE_RPRN,DE_MINS,DE_COLN, ____  ,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  ,DE_HASH, DE_DLR,DE_PIPE,DE_TILD,DE_ACUT,     DE_PLUS,DE_PERC,DE_DQUO,DE_QUOT,DE_SCLN, ____  ,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  , ____  , ____  , ____  , ____  , ____  ,      ____  , ____  , ____  , ____  , ____  , ____
  //`-------+-------+-------+-------+-------+-------'    `-------+-------+-------+-------+-------+-------'
  ),

  [L_COD_AT] = LAYOUT_ortho_4x12(
  //,-------+-------+-------+-------+-------+-------.    ,-------+-------+-------+-------+-------+-------.
     DE_ACUT,DE_EURO,DE_UNDS,DE_LBRC,DE_RBRC,DE_CIRC,     DE_EXLM,DE_LABK,DE_RABK,DE_EQL, DE_AMPR, DE_GRV,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  ,DE_BSLS,DE_SLSH,DE_LCBR,DE_RCBR,DE_ASTR,     DE_QUES,DE_LPRN,DE_RPRN,DE_MINS,DE_COLN, DE_AT ,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  ,DE_HASH, DE_DLR,DE_PIPE,DE_TILD,DE_ACUT,     DE_PLUS,DE_PERC,DE_DQUO,DE_QUOT,DE_SCLN, ____  ,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  , ____  , ____  , ____  , ____  , ____  ,      ____  , ____  , ____  , ____  , ____  , ____
  //`-------+-------+-------+-------+-------+-------'    `-------+-------+-------+-------+-------+-------'
  ),

  [L_MOV] = LAYOUT_ortho_4x12(
  //,-------+-------+-------+-------+-------+-------.    ,-------+-------+-------+-------+-------+-------.
      ____  ,KC_PGUP,KC_BSPC, KC_UP ,KC_DEL, KC_PGDN,      ____  , KC_7  , KC_8  , KC_9  ,DE_PLUS,DE_MINS,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  ,KC_HOME,KC_LEFT,KC_DOWN,KC_RGHT,KC_END ,      ____  , KC_4  , KC_5  , KC_6  ,DE_COMM, DE_DOT,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  ,KC_ESC ,KC_TAB ,KC_INS, KC_ENTER,____  ,      KC_0  , KC_1  , KC_2  , KC_3  ,DE_SCLN, ____  ,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  , ____  , ____  , ____  , ____  , ____  ,      ____  , KC_0  , ____  , ____  , ____  , ____ 
  //`-------+-------+-------+-------+-------+-------'    `-------+-------+-------+-------+-------+-------'
  ),

  [L_FUN] = LAYOUT_ortho_4x12(
  //,-------+-------+-------+-------+-------+-------.    ,-------+-------+-------+-------+-------+-------.
      ____  , AU_ON ,KC_VOLD,ME_MAXM,KC_VOLU, ____  ,     DM_REC1, KC_F7 , KC_F8 , KC_F9 , KC_F12,KC_PSCR,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  ,KC_MSTP,KC_MPRV,KC_MPLY,KC_MNXT, NEO2  ,     DM_RSTP, KC_F4 , KC_F5 , KC_F6 , KC_F11,KC_BRK ,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  , AU_OFF,KC_TAB ,KC_INS ,KC_ENTER,QWERTZ,     DM_PLY1, KC_F1 , KC_F2 , KC_F3 , KC_F10, ____  ,
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
      ____  , ____  , ____  , ____  , ____  , ____  ,      ____  , ____  , ____  , ____  , ____  , ____
  //|-------+-------+-------+-------+-------+-------|    |-------+-------+-------+-------+-------+-------|
  ),

};

#if defined(AUDIO_ENABLE)
float SONG_QWERTZ[][2] = SONG(QWERTY_SOUND);
float SONG_NEO2[][2]   = SONG(DVORAK_SOUND);
#endif

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch (keycode) {
    case QWERTZ:
      if (record->event.pressed) {
        default_layer_set(1UL<<L_QWZ);
        #if defined(AUDIO_ENABLE)
          PLAY_SONG(SONG_QWERTZ);
        #endif
      }
      return false;
      
    case NEO2:
      if (record->event.pressed) {
        default_layer_set(1UL<<L_NEO);
        #if defined(AUDIO_ENABLE)
          PLAY_SONG(SONG_NEO2);
        #endif
      }
      return false;
  }
  return true;
}

#if defined(BACKLIGHT_ENABLE)
layer_state_t layer_state_set_user(layer_state_t state) {
  switch (get_highest_layer(state)) {
  case L_COD:
  case L_COD_AT:
      backlight_set(1);
      break;
    case L_MOV:
      backlight_set(3);
      break;
    default:
      backlight_set(0);
      break;
  }
  return state;
}
#endif

A layouts/community/ortho_4x12/neo2marin/readme.md => layouts/community/ortho_4x12/neo2marin/readme.md +105 -0
@@ 0,0 1,105 @@
TheAmarin's Neo2-based Layout
================================

This layout is based on [Neo2](https://www.neo-layout.org/), an ergonomic keyboard layout optimized for coding and German language.
**neo2marin** tries to squeeze Neo2 onto the Planck keyboard.

Neo2 already uses several layers with multiple modifiers, so we don't have to invent new layers.
A major difficulty is the missing 'hashtag' key which is usually left to the 'return' key on German QWERTZ keyboards.

Another astonishing thing might be that `return`/`enter` needs a modifier (`MOD4`+`P`).

This layout makes heavy use of the split `space` key, as its left part becomes the quite important `MOD4` modifier.


## The Neo2 Main Layer

```
|----+----+----+----+----+----|    |----+----+----+----+----+------|
|TAB | X  | V  | L  | C  | W  |    | K  | H  | G  | F  | Q  | SS   |
|----+----+----+----+----+----|    |----+----+----+----+----+------|
|MOD3| U  | I  | A  | E  | O  |    | S  | N  | R  | T  | D  |Y/MOD3|
|----+----+----+----+----+----|    |----+----+----+----+----+------|
|LSFT| Ü  | Ö  | Ä  | P  | Z  |    | B  | M  | ,  | .  | J  |RSFT  |
|----+----+----+----+----+----|    |----+----+----+----+----+------|
|LCTL|LGUI|LALT|SWAP|MOD5|MOD4|    |SPC |SWAP|MOD5|APP |RALT|RCTL  |
|----+----+----+----+----+----|    |----+----+----+----+----+------|
```

Unfortunately, `y` and `MOD3` (switch to layer 3) need to share a single key.
This works for me most of the time but I am happy [to learn about your solution](https://github.com/theamarin/qmk_firmware/issues)!


## The QWERTZ fallback layer

I nearly never use this layer, so there may be room for optimization.

```
|----+----+----+----+----+----|    |----+----+----+----+----+------|
|TAB | Q  | W  | E  | R  | T  |    | Z  | U  | I  | O  | P  | Ü    |
|----+----+----+----+----+----|    |----+----+----+----+----+------|
|CAPS| A  | S  | D  | F  | G  |    | H  | J  | K  | L  | Ö  |Ä/MOD3|
|----+----+----+----+----+----|    |----+----+----+----+----+------|
|LSFT| Y  | X  | C  | V  | B  |    | N  | M  | ,  | .  | SS |RSFT  |
|----+----+----+----+----+----|    |----+----+----+----+----+------|
|LCTL|LGUI|LALT|SWAP|MOD5|MOD4|    |SPC |SWAP|RALT|APP |RALT|RCTL  |
|----+----+----+----+----+----|    |----+----+----+----+----+------|
```

The German `ß` has moved right to the `.` key, and we have to reuse `Ä` for `MOD3` again.


## MOD3: The Coding Layer

This is definitively the coolest part of Neo2, having most of the coding-related symbols right on your home row!
Of course, this is the only way to do it on Planck.

```
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|'   | €  | _  | [  | ]  | ^  |    | !  | <  | >  | =  | &  | `  |
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|MOD3, \  | /  | {  | }  | *  |    | ?  | (  | )  | -  | :  | @  |
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|LSFT, #  | $  | |  | ~  | '  |    | +  | %  | "  | '  | ;  |RSFT|
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|LCTL|LGUI|LALT|SWAP|MOD5|MOD4|    |SPC |SWAP|MOD5|APP |RALT|RCTL|
|----+----+----+----+----+----|    |----+----+----+----+----+----|
```

Because `y` and `MOD3` have to share a key, we need two variants of the MOD3 layer (as can be seen in the keymap).



## MOD4: The Movements Layer

```
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|    |PGUP|BSPC| UP |DEL |PGDN|    |    | 7  | 8  | 9  | +  | -  |
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|    |HOME|LEFT|DOWN|RGHT|END |    |    | 4  | 5  | 6  | ,  | .  |
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|    |ESC |TAB |INS |ENTR|    |    | 0  | 1  | 2  | 3  | ;  |    |
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|    |    |    |    |    |    |    |    | 0  |    |    |    |    |
|----+----+----+----+----+----|    |----+----+----+----+----+----|
```
  
  
## MOD5: The Fun(ctions) Layer

```
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|    |AUD1|VOLD|MAXM|VOLU|    |    |M1R | F7 | F8 | F9 |F12 |PSCR|
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|    |MSTP|MPRV|MPLY|MNXT|NEO2|    |M1S | F4 | F5 | F6 |F11 |BRK |
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|    |AUD0|TAB |INS |ENTR|QWERTZ   |M1P | F1 | F2 | F3 |F10 |    |
|----+----+----+----+----+----|    |----+----+----+----+----+----|
|    |    |    |    |    |    |    |    |    |    |    |    |    |
|----+----+----+----+----+----|    |----+----+----+----+----+----|
```
  

Have fun!

[Your feedback is appreciated](https://github.com/theamarin/qmk_firmware/issues)!

A layouts/community/ortho_4x12/neo2marin/rules.mk => layouts/community/ortho_4x12/neo2marin/rules.mk +6 -0
@@ 0,0 1,6 @@
DYNAMIC_MACRO_ENABLE = yes

ifeq ($(strip $(KEYBOARD)), planck/rev5)
	AUDIO_ENABLE = yes
	BACKLIGHT_ENABLE = yes
endif