1
0
Fork 0

[Keymap] crkbd/keymaps/rs: add rs keymap to corne keyboard and adapt others (#5181)

Update all my keymaps to work with 40 keys. Refactor code using
Userspace.
This commit is contained in:
Olivier Poitrey 2019-05-07 10:43:08 -07:00 committed by Drashna Jaelre
parent 3b13259942
commit 2d5c16dfd4
26 changed files with 525 additions and 354 deletions

154
users/rs/karabiner.json Normal file
View file

@ -0,0 +1,154 @@
{
"title": "RS",
"rules": [{
"description": "CapsLock to Escape / Control Mod-Tap",
"manipulators": [{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": ["any"]
}
},
"to": [{"key_code": "left_control"}],
"to_if_alone": [{"key_code": "escape"}]
}]
},
{
"description": "Right-Shift / Enter Mod-Tap",
"manipulators": [{
"type": "basic",
"from": {
"key_code": "right_shift",
"modifiers": {
"optional": ["any"]
}
},
"to": [{"key_code": "right_shift"}],
"to_if_alone": [{"key_code": "return_or_enter"}]
}]
},
{
"description": "Right-Command / Backspace Mod-Tap",
"manipulators": [{
"type": "basic",
"from": {
"key_code": "right_command",
"modifiers": {
"optional": ["any"]
}
},
"to": [{"key_code": "right_command"}],
"to_if_alone": [{"key_code": "delete_or_backspace"}]
}]
},
{
"description": "Right-Command Accents",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["left_shift", "right_shift"]
}
},
"to": [
{"key_code": "grave_accent_and_tilde", "modifiers": ["left_option"]},
{"key_code": "a"}
]
}]
},
{
"description": "Right Command Navigation",
"manipulators": [{
"type": "basic",
"from": {
"key_code": "j",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{"key_code": "left_arrow"}]
},
{
"type": "basic",
"from": {
"key_code": "k",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{"key_code": "down_arrow"}]
},
{
"type": "basic",
"from": {
"key_code": "i",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{"key_code": "up_arrow"}]
},
{
"type": "basic",
"from": {
"key_code": "l",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{"key_code": "right_arrow"}]
},
{
"type": "basic",
"from": {
"key_code": "e",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{"key_code": "page_up"}]
},
{
"type": "basic",
"from": {
"key_code": "d",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{"key_code": "page_down"}]
},
{
"type": "basic",
"from": {
"key_code": "s",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{"key_code": "home"}]
},
{
"type": "basic",
"from": {
"key_code": "f",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{"key_code": "end"}]
}]
}]
}

30
users/rs/readme.md Normal file
View file

@ -0,0 +1,30 @@
# RS: Code Friendly 40% 60% Keymaps
The rs keymap collection is an evolution of my previous keymap optimized for coding with a 60% keyboards like the Iris. I tried to keep the simplicity of my previous keymap with all the keys necessary for coding on a single layer in addition to the base one. It work well with any 40% and 60% keyboard, split or not.
To build it, use:
make <keyboard>:rs
Example:
make keebio/iris:rs
make crkbd:rs
make planck:rs
make preonic:rs
make ergotravel:rs
make handwired/rs60:rs
Because I sometime have to use my internal keyboard I my macbook, a [karabiner configuration](karabiner.json) is also provided to get most of the features of this keyboard, including the code layer / backspace on right command key etc.
This set of keymaps have been tested with those keyboards:
- [Planck](../../keyboards/planck/)
- [Preonic](../../keyboards/preonic/)
- [My preonic clone](../../keyboards/handwired/rs60/)
This keymap in is also available for other keyboards:
- [Crkdb/rs](../../keyboards/crkbd/keymaps/rs/keymap.c)
- [Iris/rs](../../keyboards/keebio/iris/keymaps/rs/keymap.c)
- [Ergotravel/rs](../../keyboards/ergotravel/keymaps/rs/keymap.c)
- [ortho_5x12/rs](../../layouts/community/ortho_5x12/rs/keymap.c)
- [ortho_4x12/rs](../../layouts/community/ortho_4x12/rs/keymap.c)

74
users/rs/rs.c Normal file
View file

@ -0,0 +1,74 @@
#include "rs.h"
// process_record_user is like process_record_user for keymaps including this file.
__attribute__ ((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
// rgb_mod_changed_keymap is called any time the RGB mod has been changed.
__attribute__ ((weak))
void rgb_mod_changed_keymap(void) {
}
// keylog_set_keymap is called for every key press.
__attribute__ ((weak))
void keylog_set_keymap(uint16_t keycode, keyrecord_t *record) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
keylog_set_keymap(keycode, record);
}
switch (keycode) {
case NEQL: // !=
if (record->event.pressed) {
SEND_STRING("!=");
}
return false;
case LPLT: // ( or < with shift
if (record->event.pressed) {
if (get_mods() & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))) {
// <
tap_code(KC_COMM); // shift is already registered
} else {
// (
register_mods(MOD_BIT(KC_LSFT));
tap_code(KC_9);
unregister_mods(MOD_BIT(KC_LSFT));
}
}
return false;
case RPGT: // ) or > with shift
if (record->event.pressed) {
if (get_mods() & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))) {
// <
tap_code(KC_DOT); // shift is already registered
} else {
// )
register_mods(MOD_BIT(KC_LSFT));
tap_code(KC_0);
unregister_mods(MOD_BIT(KC_LSFT));
}
}
return false;
#ifdef RGBLIGHT_ENABLE
case RGB_MOD:
if (record->event.pressed) {
rgblight_step();
rgb_mod_changed_keymap();
}
return false;
case RGBRST:
if (record->event.pressed) {
eeconfig_update_rgblight_default();
rgblight_enable();
rgb_mod_changed_keymap();
}
return false;
#endif
}
return process_record_keymap(keycode, record);
}

50
users/rs/rs.h Normal file
View file

@ -0,0 +1,50 @@
#pragma once
#include "quantum.h"
enum layers {
_QWERTY,
_CODE,
_FN,
};
enum custom_keycodes {
CODE = SAFE_RANGE,
FN,
LPLT,
RPGT,
NEQL,
#ifdef RGBLIGHT_ENABLE
RGBRST,
#endif
};
#define KC_ KC_TRNS
#define KC_ESCC MT(MOD_LCTL, KC_ESC)
#define KC_ENTS MT(MOD_LSFT, KC_ENT)
#define KC_LTGT LTGT // > or < with shift
#define KC_LPLT LPLT // ( or < with shift
#define KC_RPGT RPGT // ) or > with shift
#define KC_NEQL NEQL // !=
#define KC_CODE MO(_CODE)
#define KC_BCOD LT(_CODE, KC_BSPC)
#define KC_FN MO(_FN)
#define KC_RST RESET
#define KC_CTRA LCTL(KC_A)
#define KC_CTRE LCTL(KC_E)
#define KC_BLTG BL_TOGG
#define KC_BLUP BL_INC
#define KC_BLDN BL_DEC
#define KC_BLBR BL_BRTG
#ifdef RGBLIGHT_ENABLE
#define KC_LRST RGBRST
#define KC_LTOG RGB_TOG
#define KC_LHUI RGB_HUI
#define KC_LHUD RGB_HUD
#define KC_LSAI RGB_SAI
#define KC_LSAD RGB_SAD
#define KC_LVAI RGB_VAI
#define KC_LVAD RGB_VAD
#define KC_LMOD RGB_MOD
#endif

1
users/rs/rules.mk Normal file
View file

@ -0,0 +1 @@
SRC += rs.c