aboutsummaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
authorepaew <epaew@users.noreply.github.com>2019-03-10 01:22:21 +0900
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-03-09 08:22:21 -0800
commit9d915ed051c43edd828d6cdb784a5d094e9b312d (patch)
tree26e12a4eece02daa1aab74946868f0a01fc87db8 /users
parentcd9e15036e692477d37a3c1a82c5ba1f29b8a11e (diff)
downloadfirmware-9d915ed051c43edd828d6cdb784a5d094e9b312d.tar.gz
firmware-9d915ed051c43edd828d6cdb784a5d094e9b312d.tar.bz2
firmware-9d915ed051c43edd828d6cdb784a5d094e9b312d.zip
Update edvorak keymap simplify (#5350)
* Update edvorakjp layouts * swap master hand * update tapping_term
Diffstat (limited to 'users')
-rw-r--r--users/edvorakjp/edvorakjp.c6
-rw-r--r--users/edvorakjp/edvorakjp.h26
-rw-r--r--users/edvorakjp/edvorakjp_process_record.c129
-rw-r--r--users/edvorakjp/edvorakjp_status.c13
-rw-r--r--users/edvorakjp/edvorakjp_tap_dance.c36
-rw-r--r--users/edvorakjp/readme.md54
6 files changed, 38 insertions, 226 deletions
diff --git a/users/edvorakjp/edvorakjp.c b/users/edvorakjp/edvorakjp.c
index 1ac610794..892ce4be3 100644
--- a/users/edvorakjp/edvorakjp.c
+++ b/users/edvorakjp/edvorakjp.c
@@ -1,10 +1,5 @@
#include "edvorakjp.h"
-void dvorakj_layer_off(void) {
- layer_off(_EDVORAKJ1);
- layer_off(_EDVORAKJ2);
-}
-
void matrix_init_user(void) {
edvorakjp_status_init();
matrix_init_keymap();
@@ -25,7 +20,6 @@ uint32_t layer_state_set_keymap(uint32_t state) {
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_swap_scln(keycode, record) &&\
process_record_edvorakjp_config(keycode, record) &&\
process_record_layer(keycode, record) &&\
diff --git a/users/edvorakjp/edvorakjp.h b/users/edvorakjp/edvorakjp.h
index e781bf237..688cdeffb 100644
--- a/users/edvorakjp/edvorakjp.h
+++ b/users/edvorakjp/edvorakjp.h
@@ -10,9 +10,6 @@ extern keymap_config_t keymap_config;
enum edvorakjp_layers {
_EDVORAK = 0,
- _EDVORAKJ1,
- _EDVORAKJ2,
- _QWERTY,
_LOWER,
_RAISE,
_ADJUST,
@@ -21,26 +18,24 @@ enum edvorakjp_layers {
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
};
+#define KC_LC(k) LCTL_T(KC_##k)
+#define KC_LS(k) LSFT_T(KC_##k)
+#define KC_LA(k) LALT_T(KC_##k)
+#define KC_LG(k) LGUI_T(KC_##k)
+#define KC_RC(k) RCTL_T(KC_##k)
+#define KC_RS(k) RSFT_T(KC_##k)
+#define KC_RG(k) RGUI_T(KC_##k)
+#define KC_RA(k) RALT_T(KC_##k)
+
enum tap_dance_code {
TD_LOWER = 0,
TD_RAISE
@@ -57,8 +52,6 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
// status
void edvorakjp_status_init(void);
-bool get_enable_jp_extra_layer(void);
-void set_enable_jp_extra_layer(bool new_state);
bool get_enable_kc_lang(void);
void set_enable_kc_lang(bool new_state);
bool get_japanese_mode(void);
@@ -69,7 +62,6 @@ void set_japanese_mode(bool new_state);
* 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_edvorakjp_ext(uint16_t keycode, keyrecord_t *record);
bool process_record_edvorakjp_swap_scln(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);
diff --git a/users/edvorakjp/edvorakjp_process_record.c b/users/edvorakjp/edvorakjp_process_record.c
index 2dcdab2a2..ecc8db936 100644
--- a/users/edvorakjp/edvorakjp_process_record.c
+++ b/users/edvorakjp/edvorakjp_process_record.c
@@ -7,114 +7,6 @@ static uint16_t time_on_pressed;
* Each process_record_* methods defined here are
* return false if handle edvorak_keycodes, or return true others.
*/
-bool process_record_edvorakjp_ext(uint16_t keycode, keyrecord_t *record) {
- if (!(default_layer_state == 1UL<<_EDVORAK &&
- get_enable_jp_extra_layer() && get_japanese_mode())) {
- 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:
- if (record->event.pressed) {
- layer_on(_EDVORAKJ1);
- }
- return true;
-
- // N: toggle layer
- case KC_N:
- if (record->event.pressed) {
- biton32(layer_state) == _EDVORAK ? layer_on(_EDVORAKJ1) : dvorakj_layer_off();
- }
- return true;
-
- // left hand up and right hand's right side
- case KC_Y:
- case KC_P:
- case KC_W:
- case KC_Q:
- case KC_S:
- case KC_M:
- case KC_K:
- case KC_L:
- if (record->event.pressed) {
- layer_on(_EDVORAKJ2);
- }
- return true;
- // left hand down
- // If return true, QMK sends keycode in new layer,
- // but these keys are only available in old layer.
- case KC_X:
- case KC_C:
- case KC_V:
- case KC_Z:
- if (record->event.pressed) {
- layer_on(_EDVORAKJ2);
- tap_code(keycode);
- }
- return false;
- }
-
- // vowel keys, symbol keys and modifier keys
- if (record->event.pressed) {
- dvorakj_layer_off();
- }
- switch (keycode) {
- // combination vowel keys
- case KC_AI:
- if (record->event.pressed) {
- SEND_STRING("ai");
- }
- return false;
- case KC_OU:
- if (record->event.pressed) {
- SEND_STRING("ou");
- }
- return false;
- case KC_EI:
- if (record->event.pressed) {
- SEND_STRING("ei");
- }
- return false;
- case KC_ANN:
- if (record->event.pressed) {
- SEND_STRING("ann");
- }
- return false;
- case KC_ONN:
- if (record->event.pressed) {
- SEND_STRING("onn");
- }
- return false;
- case KC_ENN:
- if (record->event.pressed) {
- SEND_STRING("enn");
- }
- return false;
- case KC_INN:
- if (record->event.pressed) {
- SEND_STRING("inn");
- }
- return false;
- case KC_UNN:
- if (record->event.pressed) {
- SEND_STRING("unn");
- }
- return false;
- }
- // AOEIU and other (symbol, modifier) keys
- return true;
-}
-
bool process_record_edvorakjp_swap_scln(uint16_t keycode, keyrecord_t *record) {
#ifdef SWAP_SCLN
static const uint8_t shift_bits = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT);
@@ -146,30 +38,13 @@ bool process_record_edvorakjp_config(uint16_t keycode, keyrecord_t *record) {
set_enable_kc_lang(keycode == KC_MAC);
}
return false;
- case KC_EXTON:
- case KC_EXTOFF:
- if (record->event.pressed) {
- set_enable_jp_extra_layer(keycode == KC_EXTON);
- }
- 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;
#if TAP_DANCE_ENABLE != yes
+ switch (keycode) {
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
@@ -196,8 +71,8 @@ bool process_record_layer(uint16_t keycode, keyrecord_t *record) {
time_on_pressed = 0;
}
return false;
-#endif
}
+#endif
return true;
}
diff --git a/users/edvorakjp/edvorakjp_status.c b/users/edvorakjp/edvorakjp_status.c
index a60c8d853..128fc3bd2 100644
--- a/users/edvorakjp/edvorakjp_status.c
+++ b/users/edvorakjp/edvorakjp_status.c
@@ -4,8 +4,7 @@
typedef union {
uint8_t raw;
struct {
- bool enable_jp_extra_layer : 1;
- bool enable_kc_lang : 1; // for macOS
+ bool enable_kc_lang; // for macOS
};
} edvorakjp_config_t;
static edvorakjp_config_t edvorakjp_config;
@@ -34,15 +33,6 @@ void edvorakjp_status_init(void) {
edvorakjp_config.raw = eeconfig_read_edvorakjp();
}
-bool get_enable_jp_extra_layer(void) {
- return edvorakjp_config.enable_jp_extra_layer;
-}
-
-void set_enable_jp_extra_layer(bool new_state) {
- edvorakjp_config.enable_jp_extra_layer = new_state;
- eeconfig_update_edvorakjp(edvorakjp_config.raw);
-}
-
bool get_enable_kc_lang(void) {
return edvorakjp_config.enable_kc_lang;
}
@@ -65,7 +55,6 @@ void set_japanese_mode(bool new_state) {
SEND_STRING(SS_LALT("`"));
}
} else {
- dvorakj_layer_off();
if (edvorakjp_config.enable_kc_lang) {
SEND_STRING(SS_TAP(X_LANG2));
} else {
diff --git a/users/edvorakjp/edvorakjp_tap_dance.c b/users/edvorakjp/edvorakjp_tap_dance.c
index 62c0c100a..d5369f926 100644
--- a/users/edvorakjp/edvorakjp_tap_dance.c
+++ b/users/edvorakjp/edvorakjp_tap_dance.c
@@ -8,8 +8,11 @@ enum tap_state {
HOLD
};
-static int td_status_lower = NONE;
-static int td_status_raise = NONE;
+typedef struct {
+ uint8_t lower;
+ uint8_t raise;
+} td_status_t;
+static td_status_t td_status = {NONE, NONE};
int cur_dance(qk_tap_dance_state_t *state) {
if (state->interrupted || !state->pressed) {
@@ -20,14 +23,14 @@ int cur_dance(qk_tap_dance_state_t *state) {
}
void td_lower_finished(qk_tap_dance_state_t *state, void *user_data) {
- td_status_lower = cur_dance(state);
- switch(td_status_lower) {
+ td_status.lower = cur_dance(state);
+ switch(td_status.lower) {
case SINGLE_TAP:
set_japanese_mode(false);
- register_code(KC_ESC);
break;
case DOUBLE_TAP:
set_japanese_mode(false);
+ register_code(KC_ESC);
break;
case HOLD:
break;
@@ -36,18 +39,19 @@ void td_lower_finished(qk_tap_dance_state_t *state, void *user_data) {
}
void td_lower_reset(qk_tap_dance_state_t *state, void *user_data) {
- if (td_status_lower == SINGLE_TAP) {
+ if (td_status.lower == DOUBLE_TAP) {
unregister_code(KC_ESC);
}
layer_off(_LOWER);
- td_status_lower = NONE;
+ td_status.lower = NONE;
}
void td_raise_finished(qk_tap_dance_state_t *state, void *user_data) {
- td_status_raise = cur_dance(state);
- switch(td_status_raise) {
- case SINGLE_TAP:
+ td_status.raise = cur_dance(state);
+ switch(td_status.raise) {
case DOUBLE_TAP:
+ // same as single
+ case SINGLE_TAP:
set_japanese_mode(true);
break;
case HOLD:
@@ -58,14 +62,12 @@ void td_raise_finished(qk_tap_dance_state_t *state, void *user_data) {
void td_raise_reset(qk_tap_dance_state_t *state, void *user_data) {
layer_off(_RAISE);
- td_status_raise = NONE;
+ td_status.raise = NONE;
}
qk_tap_dance_action_t tap_dance_actions[] = {
- [TD_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(
- NULL, td_lower_finished, td_lower_reset, TAPPING_TERM * 1.5
- ),
- [TD_RAISE] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(
- NULL, td_raise_finished, td_raise_reset, TAPPING_TERM * 1.5
- )
+ [TD_LOWER] =
+ ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_lower_finished, td_lower_reset, 100),
+ [TD_RAISE] =
+ ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_raise_finished, td_raise_reset, 100)
};
diff --git a/users/edvorakjp/readme.md b/users/edvorakjp/readme.md
index 077ba4abd..679d84b3d 100644
--- a/users/edvorakjp/readme.md
+++ b/users/edvorakjp/readme.md
@@ -5,49 +5,20 @@ 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)
+- Basic layout (for ansi)
```
//+----+----+----+----+----+----+----+----+----+----+----+----+----+---------+
` , ! , @ , # , $ , % , ^ , & , * , ( , ) , [ , ] , BSPC ,
//+----+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+-------+
- TAB , ' , , , . , Y , P , F , G , R , W , Q , / , = , \ ,
+ TAB , ' , , , . , Y , Q , F , G , R , W , P , / , = , \ ,
//+------++---++---++---++---++---++---++---++---++---++---++---++---+-------+
CAPS , A , O , E , I , U , D , T , N , S , M , - , ENT ,
//+-------+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-----------+
- LSFT , ; , X , C , V , Z , B , H , J , K , L , RSFT ,
+ LSFT , : , X , C , V , Z , H , J , K , L , B , 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 , ' , , , . , Y , P , 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.
@@ -57,36 +28,25 @@ This is a sample. You can swap any symbol keys and modifier keys.
- 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 キーを横並びで配置
- - Shift押下時と非押下時で、";"キーの挙動を入れ替え(`config.h` 内で `#define SWAP_SCLN` の宣言が必要です)
+ - Shift押下時と非押下時で、";"キーの挙動を入れ替え
+ (`config.h` 内で `#define SWAP_SCLN` の宣言が必要です)
- デフォルトレイヤーには、数字キーの代わりに記号 `!@#$%^&*()` を配置
- mainly based on Dvorak layout, but XCV is available in the same position of QWERTY layout
- for Vim users
- HJKL is lining side by side
- - swap the ";" key behavior. i.e. send ":" normally and send ";" when you hold shift. (need `#define SWAP_SCLN` in your `config.h`)
+ - swap the ";" key behavior. i.e. send ":" normally and send ";" when you hold shift.
+ (need `#define SWAP_SCLN` in your `config.h`)
- we can type `!@#$%^&*()` keys without shift keys in base layer
## License