Add edvorakjp layout for the Iris keyboard (#3020)
* add edvorakjp libraries * add edvorakjp iris keymap * change the custom eeconfig's address to prevent future address conflicts * deleted the verbose line of rule.mk
This commit is contained in:
parent
c465cf2fd3
commit
760b11b5e8
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
/* Use I2C or Serial, not both */
|
||||||
|
|
||||||
|
#define USE_SERIAL
|
||||||
|
// #define USE_I2C
|
||||||
|
|
||||||
|
/* Select hand configuration */
|
||||||
|
|
||||||
|
#define MASTER_LEFT
|
||||||
|
// #define MASTER_RIGHT
|
||||||
|
// #define EE_HANDS
|
||||||
|
|
||||||
|
#undef RGBLED_NUM
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLED_NUM 10
|
||||||
|
#define RGBLIGHT_HUE_STEP 10
|
||||||
|
#define RGBLIGHT_SAT_STEP 8
|
||||||
|
#define RGBLIGHT_VAL_STEP 8
|
||||||
|
#define RGBLIGHT_LIMIT_VAL 100
|
||||||
|
|
||||||
|
#define MOUSEKEY_WHEEL_MAX_SPEED 10
|
||||||
|
#define MOUSEKEY_WHEEL_TIME_TO_MAX 20
|
||||||
|
|
||||||
|
#define TAPPING_TERM 120
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,171 @@
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
#include "action_layer.h"
|
||||||
|
#include "eeconfig.h"
|
||||||
|
|
||||||
|
#include "edvorakjp.h"
|
||||||
|
|
||||||
|
extern edvorakjp_config_t edvorakjp_config;
|
||||||
|
|
||||||
|
enum custom_keycodes {
|
||||||
|
KC_LOCK = NEW_SAFE_RANGE,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define KC_ KC_TRNS
|
||||||
|
|
||||||
|
#define KC_TMB1 LGUI_T(KC_TAB)
|
||||||
|
#define KC_TMB2 LSFT_T(KC_SPC)
|
||||||
|
#define KC_TMB3 LOWER // act as LOWER when hold, as KC_LANG2(=English) when tapped
|
||||||
|
#define KC_TMB4 LCTL_T(KC_ESC)
|
||||||
|
#define KC_TMB5 RSFT_T(KC_DEL)
|
||||||
|
#define KC_TMB6 RAISE // act as RAISE when hold, as KC_LANG1(=Japanese) when tapped
|
||||||
|
#define KC_TMB7 RCTL_T(KC_BSPC)
|
||||||
|
#define KC_TMB8 RALT_T(KC_ENT)
|
||||||
|
#define KC_TMB9 LGUI(KC_TAB)
|
||||||
|
|
||||||
|
#define KC_RST RESET
|
||||||
|
#define KC_DBUG DEBUG
|
||||||
|
#define KC_RTOG RGB_TOG
|
||||||
|
#define KC_EDJP EDVORAK
|
||||||
|
#define KC_QWER QWERTY
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[_EDVORAK] = LAYOUT_kc(
|
||||||
|
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||||
|
GRV ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,BSPC,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
LBRC,RBRC,COMM,DOT , P , Y , F , G , R , W , Q ,BSLS,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
EQL , A , O , E , I , U , D , T , N , S , M ,MINS,
|
||||||
|
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||||
|
QUOT,SCLN, X , C , V , Z ,TMB4, TMB5, B , H , J , K , L ,SLSH,
|
||||||
|
//`----+----+----+----+----+----+----/ \----+----+----+----+----+----+----'
|
||||||
|
TMB1,TMB2,TMB3, TMB6,TMB7,TMB8
|
||||||
|
// `----+----+----' `----+----+----'
|
||||||
|
),
|
||||||
|
|
||||||
|
[_EDVORAKJ1] = LAYOUT_kc(
|
||||||
|
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||||
|
, , , , , , , , , , , ,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
, AI , OU , EI , , , , , , , , ,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
, , , , , , , , , Y , , ,
|
||||||
|
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||||
|
,ANN ,ONN ,ENN ,INN ,UNN , , , , , , , , ,
|
||||||
|
//`----+----+----+----+----+----+----/ \----+----+----+----+----+----+----'
|
||||||
|
, , , , ,
|
||||||
|
// `----+----+----' `----+----+----'
|
||||||
|
),
|
||||||
|
|
||||||
|
[_EDVORAKJ2] = LAYOUT_kc(
|
||||||
|
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||||
|
, , , , , , , , , , , ,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
, AI , OU , EI , , , , , , , , ,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
, , , , , , , Y , , , , ,
|
||||||
|
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||||
|
,ANN ,ONN ,ENN ,INN ,UNN , , , , , , , , ,
|
||||||
|
//`----+----+----+----+----+----+----/ \----+----+----+----+----+----+----'
|
||||||
|
, , , , ,
|
||||||
|
// `----+----+----' `----+----+----'
|
||||||
|
),
|
||||||
|
|
||||||
|
[_QWERTY] = LAYOUT_kc(
|
||||||
|
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||||
|
GRV ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,BSPC,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
EQL , Q , W , E , R , T , Y , U , I , O , P ,MINS,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
LBRC, A , S , D , F , G , H , J , K , L ,SCLN,QUOT,
|
||||||
|
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||||
|
RBRC, Z , X , C , V , B , , , N , M ,COMM,DOT ,SLSH,BSLS,
|
||||||
|
//`----+----+----+----+----+----+----/ \----+----+----+----+----+----+----'
|
||||||
|
, , , , ,
|
||||||
|
// `----+----+----' `----+----+----'
|
||||||
|
),
|
||||||
|
|
||||||
|
[_LOWER] = LAYOUT_kc(
|
||||||
|
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||||
|
, , , , , , , ,SLSH,ASTR, , ,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
, ,BTN4,WH_U,BTN5, , , 7 , 8 , 9 ,MINS, ,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
, ,WH_L,WH_D,WH_R, , , 4 , 5 , 6 ,PLUS, ,
|
||||||
|
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||||
|
, ,BTN1,BTN3,BTN2, , , , , 1 , 2 , 3 , , ,
|
||||||
|
//`----+----+----+----+----+----+----/ \----+----+----+----+----+----+----'
|
||||||
|
, , , , 0 ,
|
||||||
|
// `----+----+----' `----+----+----'
|
||||||
|
),
|
||||||
|
|
||||||
|
[_RAISE] = LAYOUT_kc(
|
||||||
|
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||||
|
, , , , , , , , , , , ,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
F1 , F2 , F3 , F4 , F5 ,LCBR, RCBR, , , , , ,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
F6 , F7 , F8 , F9 ,F10 ,LPRN, RPRN,HOME,PGDN,PGUP,END , ,
|
||||||
|
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||||
|
F11 ,F12 ,PSCR,SLCK,PAUS,LBRC,LOCK, ,RBRC,LEFT,DOWN, UP ,RGHT, ,
|
||||||
|
//`----+----+----+----+----+----+----/ \----+----+----+----+----+----+----'
|
||||||
|
TMB9, , , , ,
|
||||||
|
// `----+----+----' `----+----+----'
|
||||||
|
),
|
||||||
|
|
||||||
|
[_ADJUST] = LAYOUT_kc(
|
||||||
|
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||||
|
, , , , , , , , , , , ,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
, , , ,EXTOFF, , ,EXTON, , , , ,
|
||||||
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
|
,RST ,DBUG,RTOG,WIN , , ,MAC ,QWER,EDJP, , ,
|
||||||
|
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||||
|
, , , , , , , , , , , , , ,
|
||||||
|
//`----+----+----+----+----+----+----/ \----+----+----+----+----+----+----'
|
||||||
|
, , , , ,
|
||||||
|
// `----+----+----' `----+----+----'
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
void matrix_init_keymap() {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch(keycode) {
|
||||||
|
case KC_LOCK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
if (edvorakjp_config.enable_kc_lang) {
|
||||||
|
SEND_STRING( SS_LCTRL(SS_LSFT(SS_TAP(X_POWER))) );
|
||||||
|
} else {
|
||||||
|
SEND_STRING( SS_LGUI("L") );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t layer_state_set_keymap(uint32_t state) {
|
||||||
|
switch (biton32(state)) {
|
||||||
|
case _EDVORAKJ1:
|
||||||
|
case _EDVORAKJ2:
|
||||||
|
// _EDVORAKJ1 & J2 are same colored
|
||||||
|
rgblight_setrgb (0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
|
case _LOWER:
|
||||||
|
rgblight_setrgb (0xFF, 0x00, 0x00);
|
||||||
|
break;
|
||||||
|
case _RAISE:
|
||||||
|
rgblight_setrgb (0x00, 0x00, 0xFF);
|
||||||
|
break;
|
||||||
|
case _ADJUST:
|
||||||
|
rgblight_setrgb (0x00, 0xFF, 0x00);
|
||||||
|
break;
|
||||||
|
default: // for any other layers, or the default layer
|
||||||
|
rgblight_mode(28);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
# edvorakjp
|
||||||
|
|
||||||
|
Epaew's Enhanced Dvorak layout for Japanese Programmer
|
||||||
|
see [here](../../../../users/edvorakjp) for more informations.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright 2018 Ryo Maeda epaew.333@gmail.com @epaew
|
||||||
|
|
||||||
|
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/>.
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Build Options
|
||||||
|
# change to "no" to disable the options, or define them in the Makefile in
|
||||||
|
# the appropriate keymap folder that will get included automatically
|
||||||
|
#
|
||||||
|
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||||
|
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||||
|
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||||
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
|
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
|
MIDI_ENABLE = no # MIDI controls
|
||||||
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
|
UNICODE_ENABLE = no # Unicode
|
||||||
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
|
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
|
@ -0,0 +1,246 @@
|
||||||
|
#include "eeprom.h"
|
||||||
|
#include "edvorakjp.h"
|
||||||
|
|
||||||
|
bool japanese_mode;
|
||||||
|
uint16_t time_on_pressed;
|
||||||
|
|
||||||
|
edvorakjp_config_t edvorakjp_config;
|
||||||
|
|
||||||
|
uint8_t eeconfig_read_edvorakjp(void) {
|
||||||
|
return eeprom_read_byte(EECONFIG_EDVORAK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void eeconfig_update_edvorakjp(uint8_t val) {
|
||||||
|
eeprom_update_byte(EECONFIG_EDVORAK, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dvorakj_layer_off(void) {
|
||||||
|
layer_off(_EDVORAKJ1);
|
||||||
|
layer_off(_EDVORAKJ2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void update_japanese_mode(bool new_state) {
|
||||||
|
japanese_mode = new_state;
|
||||||
|
if (japanese_mode) {
|
||||||
|
if (edvorakjp_config.enable_kc_lang) {
|
||||||
|
SEND_STRING(SS_TAP(X_LANG1));
|
||||||
|
} else {
|
||||||
|
SEND_STRING(SS_LALT("`"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dvorakj_layer_off();
|
||||||
|
if (edvorakjp_config.enable_kc_lang) {
|
||||||
|
SEND_STRING(SS_TAP(X_LANG2));
|
||||||
|
} else {
|
||||||
|
SEND_STRING(SS_LALT("`"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
japanese_mode = false;
|
||||||
|
time_on_pressed = 0;
|
||||||
|
edvorakjp_config.raw = eeconfig_read_edvorakjp();
|
||||||
|
|
||||||
|
matrix_init_keymap();
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_init_keymap() {}
|
||||||
|
|
||||||
|
uint32_t layer_state_set_user(uint32_t state) {
|
||||||
|
state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
|
return layer_state_set_keymap(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
uint32_t layer_state_set_keymap(uint32_t state) {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Each process_record_* methods defined here are
|
||||||
|
* return false if handle edvorak_keycodes, or return true others.
|
||||||
|
*/
|
||||||
|
__attribute__ ((weak))
|
||||||
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_edvorakjp_ext(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
if (!(edvorakjp_config.enable_jp_extra_layer &&\
|
||||||
|
(default_layer_state == 1UL<<_EDVORAK) &&\
|
||||||
|
japanese_mode &&\
|
||||||
|
record->event.pressed)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// consonant keys
|
||||||
|
// layer_on(J1) or layer_on(J2) are defined based on key positions.
|
||||||
|
switch (keycode) {
|
||||||
|
// right hand's left side w/o N
|
||||||
|
case KC_F:
|
||||||
|
case KC_G:
|
||||||
|
case KC_R:
|
||||||
|
case KC_D:
|
||||||
|
case KC_T:
|
||||||
|
case KC_B:
|
||||||
|
case KC_H:
|
||||||
|
case KC_J:
|
||||||
|
layer_on(_EDVORAKJ1);
|
||||||
|
register_code(keycode);
|
||||||
|
unregister_code(keycode);
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// N: toggle layer
|
||||||
|
case KC_N:
|
||||||
|
biton32(layer_state) == _EDVORAK ? layer_on(_EDVORAKJ1) : dvorakj_layer_off();
|
||||||
|
register_code(keycode);
|
||||||
|
unregister_code(keycode);
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// left hand and right hand's right side
|
||||||
|
case KC_X:
|
||||||
|
case KC_C:
|
||||||
|
case KC_V:
|
||||||
|
case KC_Z:
|
||||||
|
case KC_P:
|
||||||
|
case KC_Y:
|
||||||
|
case KC_W:
|
||||||
|
case KC_Q:
|
||||||
|
case KC_S:
|
||||||
|
case KC_M:
|
||||||
|
case KC_K:
|
||||||
|
case KC_L:
|
||||||
|
layer_on(_EDVORAKJ2);
|
||||||
|
register_code(keycode);
|
||||||
|
unregister_code(keycode);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// vowel keys, symbol keys and modifier keys
|
||||||
|
dvorakj_layer_off();
|
||||||
|
switch (keycode) {
|
||||||
|
// combination vowel keys
|
||||||
|
case KC_AI:
|
||||||
|
SEND_STRING("ai");
|
||||||
|
return false;
|
||||||
|
case KC_OU:
|
||||||
|
SEND_STRING("ou");
|
||||||
|
return false;
|
||||||
|
case KC_EI:
|
||||||
|
SEND_STRING("ei");
|
||||||
|
return false;
|
||||||
|
case KC_ANN:
|
||||||
|
SEND_STRING("ann");
|
||||||
|
return false;
|
||||||
|
case KC_ONN:
|
||||||
|
SEND_STRING("onn");
|
||||||
|
return false;
|
||||||
|
case KC_ENN:
|
||||||
|
SEND_STRING("enn");
|
||||||
|
return false;
|
||||||
|
case KC_INN:
|
||||||
|
SEND_STRING("inn");
|
||||||
|
return false;
|
||||||
|
case KC_UNN:
|
||||||
|
SEND_STRING("unn");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// AOEIU and other (symbol, modifier) keys
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_edvorakjp_config(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case KC_MAC:
|
||||||
|
edvorakjp_config.enable_kc_lang = true;
|
||||||
|
eeconfig_update_edvorakjp(edvorakjp_config.raw);
|
||||||
|
return false;
|
||||||
|
case KC_WIN:
|
||||||
|
edvorakjp_config.enable_kc_lang = false;
|
||||||
|
eeconfig_update_edvorakjp(edvorakjp_config.raw);
|
||||||
|
return false;
|
||||||
|
case KC_EXTON:
|
||||||
|
edvorakjp_config.enable_jp_extra_layer = true;
|
||||||
|
eeconfig_update_edvorakjp(edvorakjp_config.raw);
|
||||||
|
return false;
|
||||||
|
case KC_EXTOFF:
|
||||||
|
edvorakjp_config.enable_jp_extra_layer = false;
|
||||||
|
eeconfig_update_edvorakjp(edvorakjp_config.raw);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_layer(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case EDVORAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_EDVORAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
case QWERTY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
dvorakj_layer_off();
|
||||||
|
set_single_persistent_default_layer(_QWERTY);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
case LOWER:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
layer_on(_LOWER);
|
||||||
|
time_on_pressed = record->event.time;
|
||||||
|
} else {
|
||||||
|
layer_off(_LOWER);
|
||||||
|
|
||||||
|
if (TIMER_DIFF_16(record->event.time, time_on_pressed) < TAPPING_TERM) {
|
||||||
|
update_japanese_mode(false);
|
||||||
|
}
|
||||||
|
time_on_pressed = 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
case RAISE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
layer_on(_RAISE);
|
||||||
|
time_on_pressed = record->event.time;
|
||||||
|
} else {
|
||||||
|
layer_off(_RAISE);
|
||||||
|
|
||||||
|
if (TIMER_DIFF_16(record->event.time, time_on_pressed) < TAPPING_TERM) {
|
||||||
|
update_japanese_mode(true);
|
||||||
|
}
|
||||||
|
time_on_pressed = 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_ime(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case KC_JPN:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
update_japanese_mode(true);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
case KC_ENG:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
update_japanese_mode(false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
|
return process_record_keymap(keycode, record) &&\
|
||||||
|
process_record_edvorakjp_ext(keycode, record) &&\
|
||||||
|
process_record_edvorakjp_config(keycode, record) &&\
|
||||||
|
process_record_layer(keycode, record) &&\
|
||||||
|
process_record_ime(keycode, record);
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
#ifndef USERSPACE
|
||||||
|
#define USERSPACE
|
||||||
|
|
||||||
|
#include "quantum.h"
|
||||||
|
#include "action_layer.h"
|
||||||
|
|
||||||
|
#define EECONFIG_EDVORAK (uint8_t *)20
|
||||||
|
|
||||||
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
uint8_t raw;
|
||||||
|
struct {
|
||||||
|
bool enable_jp_extra_layer : 1;
|
||||||
|
bool enable_kc_lang : 1; // for macOS
|
||||||
|
};
|
||||||
|
} edvorakjp_config_t;
|
||||||
|
|
||||||
|
enum edvorakjp_layers {
|
||||||
|
_EDVORAK = 0,
|
||||||
|
_EDVORAKJ1,
|
||||||
|
_EDVORAKJ2,
|
||||||
|
_QWERTY,
|
||||||
|
_LOWER,
|
||||||
|
_RAISE,
|
||||||
|
_ADJUST,
|
||||||
|
_EXTRA,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum edvorakjp_keycodes {
|
||||||
|
EDVORAK = SAFE_RANGE,
|
||||||
|
QWERTY,
|
||||||
|
LOWER,
|
||||||
|
RAISE,
|
||||||
|
KC_MAC,
|
||||||
|
KC_WIN,
|
||||||
|
KC_EXTON,
|
||||||
|
KC_EXTOFF,
|
||||||
|
KC_JPN,
|
||||||
|
KC_ENG,
|
||||||
|
KC_AI,
|
||||||
|
KC_OU,
|
||||||
|
KC_EI,
|
||||||
|
KC_ANN,
|
||||||
|
KC_ONN,
|
||||||
|
KC_ENN,
|
||||||
|
KC_INN,
|
||||||
|
KC_UNN,
|
||||||
|
NEW_SAFE_RANGE
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t eeconfig_read_edvorakjp(void);
|
||||||
|
void eeconfig_update_edvorakjp(uint8_t val);
|
||||||
|
|
||||||
|
void dvorakj_layer_off(void);
|
||||||
|
void update_japanese_mode(bool new_state);
|
||||||
|
void matrix_init_user(void);
|
||||||
|
void matrix_init_keymap(void);
|
||||||
|
uint32_t layer_state_set_user(uint32_t state);
|
||||||
|
uint32_t layer_state_set_keymap(uint32_t state);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Each process_record_* methods defined here are
|
||||||
|
* return false if processed, or return true if not processed.
|
||||||
|
* You can add your original macros in process_record_keymap() in keymap.c.
|
||||||
|
*/
|
||||||
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
|
||||||
|
bool process_record_edvorakjp_ext(uint16_t keycode, keyrecord_t *record);
|
||||||
|
bool process_record_edvorakjp_config(uint16_t keycode, keyrecord_t *record);
|
||||||
|
bool process_record_layer(uint16_t keycode, keyrecord_t *record);
|
||||||
|
bool process_record_ime(uint16_t keycode, keyrecord_t *record);
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,103 @@
|
||||||
|
# edvorakjp
|
||||||
|
|
||||||
|
epaew's Enhanced Dvorak layout for Japanese Programmer
|
||||||
|
|
||||||
|
## Layout overview
|
||||||
|
This is a sample. You can swap any symbol keys and modifier keys.
|
||||||
|
|
||||||
|
- Base layer (for ansi layout)
|
||||||
|
```
|
||||||
|
//+----+----+----+----+----+----+----+----+----+----+----+----+----+---------+
|
||||||
|
` , ! , @ , # , $ , % , ^ , & , * , ( , ) , [ , ] , BSPC ,
|
||||||
|
//+----+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+-------+
|
||||||
|
TAB , ' , , , . , P , Y , F , G , R , W , Q , / , = , \ ,
|
||||||
|
//+------++---++---++---++---++---++---++---++---++---++---++---++---+-------+
|
||||||
|
CAPS , A , O , E , I , U , D , T , N , S , M , - , ENT ,
|
||||||
|
//+-------+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-----------+
|
||||||
|
LSFT , ; , X , C , V , Z , B , H , J , K , L , RSFT ,
|
||||||
|
//+------+--+---++----++---+----+----+----+----+-+--+---++----++------+------+
|
||||||
|
LCTL , LGUI , LALT , SPACE , RALT , RGUI , MENU , RCTL
|
||||||
|
//+------+------+------+-------------------------+------+------+------+------+
|
||||||
|
```
|
||||||
|
- Base layer (for iso layout)
|
||||||
|
- Two C keys are placed, it's on purpose.
|
||||||
|
```
|
||||||
|
//+----+----+----+----+----+----+----+----+----+----+----+----+----+---------+
|
||||||
|
` , ! , @ , # , $ , % , ^ , & , * , ( , ) , [ , ] , BSPC ,
|
||||||
|
//+----+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+-------+
|
||||||
|
TAB , ' , , , . , P , Y , F , G , R , W , C , / , = ,
|
||||||
|
//+------++---++---++---++---++---++---++---++---++---++---++---++---++
|
||||||
|
CAPS , A , O , E , I , U , D , T , N , S , M , ; , - , ENT ,
|
||||||
|
//+-------+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+------+
|
||||||
|
LSFT , Q , X , C , V , Z , B , H , J , K , L , \ , RSFT ,
|
||||||
|
//+------+--+---++----++---+----+----+----+----+-+--+---++----++---+--+------+
|
||||||
|
LCTL , LGUI , LALT , SPACE , RALT , RGUI , MENU , RCTL
|
||||||
|
//+------+------+------+-------------------------+------+------+------+------+
|
||||||
|
```
|
||||||
|
- Additional layer (common, blanks are transparent)
|
||||||
|
```
|
||||||
|
//+----+----+----+----+----+----+----+----+----+----+----+----+----+---------+
|
||||||
|
, , , , , , , , , , , , , ,
|
||||||
|
//+----+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+-------+
|
||||||
|
, AI , OU , EI , , , , , , , , , , ,
|
||||||
|
//+------++---++---++---++---++---++---++---++---++---++---++---++---+-------+
|
||||||
|
, A , O , E , I , U , , Y1 , N , Y2 , , , ,
|
||||||
|
//+-------+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-----------+
|
||||||
|
,ANN ,ONN ,ENN ,INN ,UNN , , , , , , ,
|
||||||
|
//+------+--+---++----++---+----+----+----+----+-+--+---++----++------+------+
|
||||||
|
, , , , , , ,
|
||||||
|
//+------+------+------+-------------------------+------+------+------+------+
|
||||||
|
```
|
||||||
|
|
||||||
|
And you can see [my iris keyboard layout](../../keyboards/iris/keymaps/edvorakjp/keymap.c) for sample implementation, too.
|
||||||
|
|
||||||
|
## for Japanese
|
||||||
|
|
||||||
|
- 日本語入力用のキーを追加
|
||||||
|
- IME 切り替えキー
|
||||||
|
- 長押しでレイヤー切り替え、短押しでIME切り替え
|
||||||
|
- macOS(かな/英数)、Windows(Alt+\`)の両方に対応
|
||||||
|
- DvorakJP(<http://www7.plala.or.jp/dvorakjp/>)を参考にした日本語入力用キーの導入
|
||||||
|
- 拗音入力用のYキーを追加配置
|
||||||
|
- 二重母音入力用のキー(AI, OU, EI)
|
||||||
|
- 撥音入力用のキー(ANN, ONN, ENN, INN, UNN)
|
||||||
|
- いずれかの子音を押下することで Additional layer が出現し、いずれかの母音を押下することで Base layer に戻ります(※1※2)
|
||||||
|
- ※1促音の入力に使うため、また連続で同じ指での打鍵を減らすために、
|
||||||
|
FGRDTNBHJ を押下した場合はy1が、それ以外の子音を押下した場合はy2が出現しません
|
||||||
|
- ※2撥音の入力のため、nを2連打すると、Base layerに戻ります
|
||||||
|
- Define some custom keys for typing Japanese
|
||||||
|
- IME switching
|
||||||
|
- act as LOWER/RAISE when hold, act as IME switching when tapped
|
||||||
|
- for macOS(かな/英数), for Windows(Alt+\`)
|
||||||
|
- oneshot combination keys, inspired from DvorakJP (<http://www7.plala.or.jp/dvorakjp/>)
|
||||||
|
- additional Y key to enter a contracted sound
|
||||||
|
- diphthong keys (AI, OU, EI)
|
||||||
|
- syllabic nasal (ANN, ONN, ENN, INN, UNN)
|
||||||
|
- Additional layer is appeared when you taps any consonant keys, and disappeared when you taps any diphthong keys.
|
||||||
|
|
||||||
|
## for Programmer
|
||||||
|
|
||||||
|
- Dvorak 配列をベースに、ショートカットでよく利用される XCV は QWERTY 配列の位置を維持
|
||||||
|
- Vimユーザのために、HJKL キーを横並びで配置
|
||||||
|
- デフォルトレイヤーには、数字キーの代わりに記号 `!@#$%^&*()` を配置
|
||||||
|
|
||||||
|
- mainly based on Dvorak layout, but XCV is available in the same position of QWERTY layout
|
||||||
|
- HJKL is lining side by side, for Vim users
|
||||||
|
- we can type `!@#$%^&*()` keys without shift keys in base layer
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright 2018 Ryo Maeda epaew.333@gmail.com @epaew
|
||||||
|
|
||||||
|
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/>.
|
|
@ -0,0 +1 @@
|
||||||
|
SRC += edvorakjp.c
|
Loading…
Reference in New Issue