[Keymap] Added Brazilian keymap for BM40RGB (#14431)

This commit is contained in:
Lui Wolff 2021-09-18 16:06:46 +00:00 committed by GitHub
parent c681c1a6a8
commit 2c4660e40d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 199 additions and 0 deletions

View file

@ -0,0 +1,164 @@
/* Copyright 2021 lmlmask
*
* 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_br_abnt2.h"
enum layers {
_WORKMAN,
_QWERTY,
_DVORAK,
_COLEMAK,
_SYM,
_FUNCTION,
_MIDI,
_NAV,
_NUM,
_ADJUST
};
enum planck_keycodes {
WORKMAN = SAFE_RANGE,
QWERTY,
DVORAK,
COLEMAK,
MIDI
};
#define SYM MO(_SYM)
#define FUN LT(_FUNCTION, KC_ENT)
#define MYTAB LT(_NAV, KC_TAB)
#define MYNAV LT(_NAV, KC_DEL)
#define MYNUM LT(_NUM, KC_BSPC)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//qwerty base layer ok
[_QWERTY] = LAYOUT_planck_mit(
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, BR_TILD,
MYTAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, BR_CCED, BR_ACUT,
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, BR_SLSH, KC_RSPC,
KC_LCTL, KC_LALT, KC_LGUI, SYM, MYNAV, KC_SPC, MYNUM, FUN, KC_RGUI, KC_LALT, RCTL_T(KC_ENT)
),
//workman base layer ok
[_WORKMAN] = LAYOUT_planck_mit(
KC_ESC, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, BR_CCED, BR_TILD,
MYTAB, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, BR_ACUT,
KC_LSPO, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, BR_SLSH, KC_RSPC,
KC_LCTL, KC_LALT, KC_LGUI, SYM, MYNAV, KC_SPC, MYNUM, FUN, KC_RGUI, KC_LALT, RCTL_T(KC_ENT)
),
//dvorak base layer ok
[_DVORAK] = LAYOUT_planck_mit(
KC_ESC, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, BR_SLSH, BR_TILD,
MYTAB, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, BR_ACUT,
KC_LSPO, BR_CCED, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSPC,
KC_LCTL, KC_LALT, KC_LGUI, SYM, MYNAV, KC_SPC, MYNUM, FUN, KC_RGUI, KC_LALT, RCTL_T(KC_ENT)
),
//colemak base layer ok
[_COLEMAK] = LAYOUT_planck_mit(
KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, BR_CCED, BR_TILD,
MYTAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, BR_ACUT,
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, BR_SLSH, KC_RSPC,
KC_LCTL, KC_LALT, KC_LGUI, SYM, MYNAV, KC_SPC, MYNUM, FUN, KC_RGUI, KC_LALT, RCTL_T(KC_ENT)
),
//navigation and utility layer ok
[_NAV] = LAYOUT_planck_mit(
KC_TRNS, _______, _______, _______, _______, _______, _______, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_VOLU,
_______, _______, _______, _______, BR_QUOT, _______, KC_ENT, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_VOLD,
KC_TRNS, KC_UNDO, KC_CUT, KC_COPY, KC_PSTE, _______, _______, KC_BSPC, KC_DEL, _______, _______, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, _______, _______, _______, MYNUM, _______, KC_MPRV, KC_MPLY, KC_MNXT
),
//symbols layer ok
[_SYM] = LAYOUT_planck_mit(
BR_DQUO, BR_EXLM, BR_AT, BR_HASH, BR_DLR, BR_PERC, BR_DIAE, BR_AMPR, BR_ASTR, BR_LPRN, BR_RPRN, BR_COLN,
BR_QUOT, BR_PIPE, _______, _______, _______, _______, _______, BR_PLUS, BR_UNDS, BR_LBRC, BR_RBRC, BR_SCLN,
KC_TRNS, BR_BSLS, _______, _______, _______, _______, _______, BR_EQL, BR_MINS, BR_LCBR, BR_RCBR, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, _______, _______, _______, _______, _______, KC_TRNS, KC_TRNS, KC_TRNS
),
//numbers layer ok
[_NUM] = LAYOUT_planck_mit(
KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, BR_MINS,
_______, BR_ASTR, BR_SLSH, BR_MINS, BR_PLUS, _______, _______, KC_4, KC_5, KC_6, BR_COMM, BR_PLUS,
KC_TRNS, BR_PERC, BR_EQL, BR_DOT, BR_COMM, _______, _______, KC_1, KC_2, KC_3, BR_DOT, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, _______, MYNAV, _______, _______, KC_0, KC_0, KC_COMM, KC_ENT
),
//FN layer
[_FUNCTION] = LAYOUT_planck_mit(
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, _______, _______, KC_F13, KC_F14, KC_F15, KC_F16, KC_INS,
KC_PSCR, KC_F5, KC_F6, KC_F7, KC_F8, _______, _______, KC_F17, KC_F18, KC_F19, KC_F20, KC_PAUS,
KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_F21, KC_F22, KC_F23, KC_F24, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, _______, _______, _______, _______, _______, KC_TRNS, KC_TRNS, KC_TRNS
),
// adjust layer ok
[_ADJUST] = LAYOUT_planck_mit(
RESET, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, _______, _______, _______, _______, _______, _______,
KC_CAPS, RGB_RMOD,RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD, _______, QWERTY, DVORAK, COLEMAK, WORKMAN, MIDI,
_______, MI_ON, MI_OFF, MI_TOG, MU_ON, MU_OFF, MU_TOG, MU_MOD, AU_ON, AU_OFF, _______, _______,
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
// midi layer
[_MIDI] = LAYOUT_planck_mit(
MI_Cs, MI_Ds, _______, MI_Fs, MI_Gs, MI_As, _______, MI_Cs, MI_Ds, _______, MI_Fs, MI_Gs,
MI_C, MI_D, MI_E, MI_F, MI_G, MI_A, MI_B, MI_C, MI_D, MI_E, MI_F, MI_G,
MI_BENDU,MI_OCTU, MI_TRNSU,MI_VELU, _______, _______, _______, _______, _______, MI_ON, MI_CHU, MI_TOG,
MI_BENDD,MI_OCTD, MI_TRNSD,MI_VELD, MYNAV, MI_SUS, MYNUM, _______, MI_OFF, MI_CHD, MI_ALLOFF
)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY);
}
return false;
case WORKMAN:
if (record->event.pressed) {
set_single_persistent_default_layer(_WORKMAN);
}
return false;
case DVORAK:
if (record->event.pressed) {
set_single_persistent_default_layer(_DVORAK);
}
return false;
case COLEMAK:
if (record->event.pressed) {
set_single_persistent_default_layer(_COLEMAK);
}
return false;
case MIDI:
if (record->event.pressed) {
set_single_persistent_default_layer(_MIDI);
}
return false;
}
return true;
}
layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _NAV, _NUM, _ADJUST);
}

View file

@ -0,0 +1,35 @@
# Brazilian keymap for the BM40RGB keyboard
![qwerty](https://user-images.githubusercontent.com/62627597/133505514-466192cf-c58f-4b6f-9b7c-53ec36078401.png)
This keymap deviates somewhat from the generally used conventions of Planck style keyboards.
It's built on the following principles:
1. Availability of different base layers. QWERTY, Dvorak, Colemak and Workman are available. They can be chosen with the four right hand home row keys on the ADJUST layer (NAV + NUM keys). The base layout you choose gets stored on the keyboard EEPROM, so it will still be set if you unplug or reset the keyboard. I use Workman, so it's the default, but you can change to QWERTY easily with NAV + NUM + J (the J in QWERTY).
2. Frequent use of navigation keys such as the arrow keys, home, end, and hotkeys using those keycodes. For that reason, it keeps the navigation keys on a dedicated nav layer, on the home row, under the right hand. The nav layer gets the highly accessible layer toggle button usually used for the LOWER layer on most Planck style keymaps. I find this much better than using dedicated arrow keys on the bottom right of the keyboard, as the very reason I swapped to a 40% is to move my hands less.
3. Accessibility of the ´ ` ^ ~ ç symbols. There are several blank spaces left on the symbols layer, if you need access to other symbols or diacritics.
4. Proper touch typing, and hotkey access, with the Ctrl, Shift, Win/Super and Alt modifiers on both sides. I found my hands very much expect Ctrl to be on the edge of the keyboard, and as such I've kept both bottom corner keys as Ctrl. Using those keys as layer modifiers, albeit common in many keymaps, is something I found to be somewhat awkward, as it makes it basically impossible to use the hand used to press them.
5. Numbers and navigation keys should be slightly more accessible than symbols and function keys. If you use symbols more often, consider swapping the NUM and SYM layer toggle keys.
6. It's easier to remember layers when they make sense conceptually. Hence, there are dedicated layers for navigation/utility (NAV), numbers (NUM), symbols (SYM) and function keys (FN). There's a dedicated MIDI layer. Don't forget to add #define MIDI_ADVANCED to your config.h if you plan on using it.
7. Tap hold is a good tool and you should use it if you can. Backspace and Delete are set as tap functions on the two more accessible layer toggle keys.
It will only work as intended if your system keyboard layout is set to Brazilian ABNT2. It may work with other international layouts, but some keys, including brackets and the ´ ` ~ ^ keys, will get broken.
# Layers and functions
In each key:
Top left: Symbols;
Top right: Functions;
Bottom left: Navigation;
Bottom right: Numbers;
Bottom: secondary function (tap/hold)
# BASE (Qwerty, Dvorak, Colemak, Workman)
![qwerty](https://user-images.githubusercontent.com/62627597/133505788-e8410162-8491-4f52-bc94-62dacb752171.png)
# Adjust (NAV+NUM)
![adjust](https://user-images.githubusercontent.com/62627597/133182475-1994e733-71a2-42ee-88fe-9a15e711b938.png)
# MIDI
![midi](https://user-images.githubusercontent.com/62627597/133505599-8ae3ea32-5f8f-451f-b191-f74c514d22c0.png)