Skip to content

Commit

Permalink
Merge pull request #18 from rafaelromao/magic-h
Browse files Browse the repository at this point in the history
Replace H by Magic-H (H, V, Y or OS Alpha 2, according to the previous key)
  • Loading branch information
rafaelromao authored May 25, 2024
2 parents d2a1c1a + 7fb9e04 commit da576a6
Show file tree
Hide file tree
Showing 30 changed files with 420 additions and 620 deletions.
17 changes: 10 additions & 7 deletions docs/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@
- The Alpha1 layer is the base layer, which contains the most common alphas of Portuguese and English, plus comma and period. It is extended by the Alpha2 layer.

### Secondary Alpha Layer
- The Alpha2 layer has common Portuguese accented letters, readily available with a single tap on the right inner thumb key (OS Accents), making them as easy to type as shifted letters, which are available with a single tap on the right outer thumb key (OS Shift).
- There are dedicated accent keys for à á â é ê ó ô ú í and ç, as well as a dead key for ~, which is all that is needed for Portuguese.
- This layer also gives access to comma, dot and replicated versions of q, y, w, v, z and j, that are not available in the base layer, for the 24 keys variant, as well as an standalone apostrophe character in the thumb.
- The Alpha2 layer has common Portuguese accentuated letters, readily available with a single tap on the right inner thumb key, along with the alphas that are missing in the base layer.
- There are dedicated keys for `à` `á` `â` `é` `ê` `ó` `ô` `ú` `í` and `ç`, as well, which is all that is needed for Portuguese.
- This two alpha layers approach is based on [Ben Vallack's keymap](https://youtu.be/5RN_4PQ0j1A?si=f9OkOvNdL3jE4seR).

#### Ç Extension
- There is an extension to the Secondary Alpha Layer, which I call *Ç Extension*. It activates an one-shot layer just after `ç` is typed, to allow easy access to the vowels and accentuated vowels that are commonly seen after `ç`, in Portuguese, so that typing common bigrams like `çã` and `çõ` will not require two consecutive activations of the Secondary Alpha Layer. The characters `a`, `ã`, `â`, `o`, `ô`, `õ`, `u` and `ú` are available in this layer, while `e`, `é`, `ê` and `í` are not, since they will never appear after `ç`. The position of these characters in the secondary alpha layer is also thought to support this.

### Magic Key
- The Bottom Row Index Key, in the right hand, is programmed to act as a Magic Key. It will behave like `H` after most consonants, like `V` after vowels or accentuated vowels, like `Y` after `B`, `M`, `D` and `F`, and will reactivate the Secondary Alpha Layer when tapped after a consonant from the Secondary Alpha Layer. To see more about that, check the [Magic Romak](https://github.com/rafaelromao/romak/tree/main?tab=readme-ov-file#magic-romak) page.

## Smart Thumb Keys
- The Smart Thumb keys in this layout change behavior according to the context (active layer, active modifiers and more).
- The four thumb keys control layer transitions, when held (Navigation, Lower, Raise and Media).

### Smart Repeat / Magic Key
- The outer left thumb key repeats the last key by default (Repeat Key), but outputs an alternate result for keys that do not worth repeating (Alternate Repeat Key).
- When tapped in the secondary alpha layer, this key outputs alternate results by default (Magic Key), but repeats the key when there is no predefined alternate result.
- See more about that [here](https://github.com/rafaelromao/romak/tree/main?tab=readme-ov-file#magic-romak).
### Repeat Key
- The outer left thumb key repeats the last key by default, but outputs an alternate result for keys that do not worth repeating. For `Ç`, the repeat key reactivates the Secondary Alpha Layer, which makes it easier to type `çã` and `çõ`.
- Holding this key in the base layer will activate the [Navigation](../navigation.md) layer.
- Tapping or holding this key in the [Raise](../symbols.md) layer acts as a normal Repeat Key, which can be used to spam or to repeat shortcuts.

Expand Down
Binary file modified img/overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions init_zmk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ archive_zen_right="mkdir -p $KEYBOARD_HOME/build/artifacts; [ -f build/corneish_
alias build_zen_both_sides="cd ${ZMK_HOME} && ${build_zen_left} && ${archive_zen_left} && ${build_zen_right} && ${archive_zen_right} && cd ${KEYBOARD_HOME}"
alias build_zen="cd ${ZMK_HOME} && ${build_zen_left} && ${archive_zen_left} && cd ${KEYBOARD_HOME}"

echo "Creating Aellopos build alias..."
build_aellopos_unibody="west build -s app -b nice_nano_v2 --build-dir build/aellopos -- -DSHIELD='aellopos' -DZMK_CONFIG=$KEYBOARD_HOME/src/zmk/boards/handwired"
archive_aellopos_unibody="mkdir -p $KEYBOARD_HOME/build/artifacts; [ -f build/aellopos/zephyr/zmk.uf2 ] && mv build/aellopos/zephyr/zmk.uf2 $KEYBOARD_HOME/build/artifacts/aellopos-zmk.uf2"
alias build_aellopos="cd ${ZMK_HOME} && ${build_aellopos_unibody} && ${archive_aellopos_unibody} && cd $KEYBOARD_HOME"
echo "Creating Rommana build alias..."
build_rommana_unibody="west build -s app -b seeeduino_xiao_rp2040 --build-dir build/rommana -- -DSHIELD='rommana' -DZMK_CONFIG=$KEYBOARD_HOME/src/zmk/boards/handwired"
archive_rommana_unibody="mkdir -p $KEYBOARD_HOME/build/artifacts; [ -f build/rommana/zephyr/zmk.uf2 ] && mv build/rommana/zephyr/zmk.uf2 $KEYBOARD_HOME/build/artifacts/rommana-zmk.uf2"
alias build_rommana="cd ${ZMK_HOME} && ${build_rommana_unibody} && ${archive_rommana_unibody} && cd $KEYBOARD_HOME"

echo "Creating Cygnus alias..."
build_cygnus_left="west build -s app -b nice_nano_v2 --build-dir build/cygnus_left -- -DSHIELD='cygnus_left' -DZMK_CONFIG=$KEYBOARD_HOME/src/zmk/boards/handwired"
Expand Down
15 changes: 7 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ The following pages explain how this layout works and which features are impleme

- [Smart Modifiers](docs/modifiers.md)
- [Smart Thumb Keys](docs/base.md#smart-thumb-keys)
- [Smart Repeat / Magic Key](docs/base.md#smart-thumb-keys)
- [Smart Shift / Caps Word](docs/base.md#smart-thumb-keys)
- [Smart Cases](docs/modifiers.md#smart-cases)
- [Sentence Case](docs/base.md#sentence-case)
- [Repeat Key](docs/base.md#repeat-key)
- [Magic Key](docs/base.md#magic-key)
- [Shortcut Combos](docs/base.md#base-layer-combos)
- [Numpad Layer](docs/symbols.md#numpad)
- [NumWord](docs/symbols.md#numword)
Expand All @@ -47,14 +48,10 @@ This layout was tested with the keyboards listed below, but can be easily adapte

### QMK

The reference implementation is done in QMK, so it has all features supported.
The reference implementation was made in QMK, but it is kept here for historical purposes only. It will not receive evolutive maintenance and might not be in sync with the documentation. To see the lastest version of the docs that is in sync with the implementation, check the branch called `last_qmk`, or the tags `v0.36*`.

The QMK version recommended for this keymap is 0.22.10.
The keyboards that are still kept in QMK are the ones listed below:

The tested boards are listed below:

- [handwired/rafaelromao/fauxberry](src/qmk/keyboards/handwired/rafaelromao/fauxberry/readme.md)
- [handwired/rafaelromao/rommana](src/qmk/keyboards/handwired/rafaelromao/rommana/readme.md)
- [kprepublic/bm40hsrgb](src/qmk/keyboards/kprepublic/bm40hsrgb/keymaps/rafaelromao/readme.md)
- [xiudi/xd75](src/qmk/keyboards/xiudi/xd75/keymaps/rafaelromao/readme.md)

Expand All @@ -73,8 +70,9 @@ The zmk version used for this keymap is the one available in [this fork](https:/

This fork is also updated to Zephyr 3.5.

The tested boards are listed below:
The keyboards that run the ZMK implementation of this Keymap are listed below:

- [Rommana](src/zmk/boards/handwired/boards/shields/rommana/readme.md)
- [Corne-ish Zen](src/zmk/boards/lowprokb.ca/corneish-zen/readme.md)
- [Dactyl Cygnus](src/zmk/boards/handwired/boards/shields/cygnus/readme.md)

Expand All @@ -97,6 +95,7 @@ After [installing ZMK](https://zmk.dev/docs/development/setup) and running the i
Most features implemented here were based on the work referenced below.

### Layouts
- [Romak](https://github.com/rafaelromao/romak)
- [Colemak](https://colemak.org)
- [BEAKL](https://ieants.cc/beakl)
- [Hands Down](https://sites.google.com/alanreiser.com/handsdown/home)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once

// Configure RGB
#define RGBLIGHT_HUE_STEP 20
#define RGBLIGHT_HUE_STEP 20

#define SAVE_MEMORY
4 changes: 3 additions & 1 deletion src/qmk/keyboards/xiudi/xd75/keymaps/rafaelromao/config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once

// Configure RGB
#define RGBLIGHT_SLEEP
#define RGBLIGHT_SLEEP

#define SAVE_MEMORY
7 changes: 6 additions & 1 deletion src/qmk/users/rafaelromao/definitions/keycodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,9 @@ bool is_shift_macro_keycode(uint16_t keycode) {

bool is_accent_macro_keycode(uint16_t keycode) {
return keycode > ACCENT_MACRO_START && keycode < ACCENT_MACRO_END;
}
}

bool is_shifted(void) {
return get_mods() & MOD_MASK_SHIFT || get_oneshot_mods() & MOD_MASK_SHIFT ||
get_oneshot_locked_mods() & MOD_MASK_SHIFT;
}
11 changes: 6 additions & 5 deletions src/qmk/users/rafaelromao/definitions/keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ enum {
// Begin macros used to write text
STR_MACRO_START,

MC_NG, MC_EY, MC_HY, MC_OU, MC_COM, MC_AO, MC_ES, MC_OES, MC_FIX_I,
MC_BTIC, MC_DQUO, MC_SQUO, MC_CIRC, MC_TILD, MC_ORDO, MC_ORDA,
MC_EUR, MC_LTE, MC_GTE, MC_DDS, MC_ENT, MC_TAB, MC_ESC, MC_ESCC,
TG_NUMC, MC_EXLM, MC_QUES, MC_ESAV, MC_SENT, MC_DEG, MC_DELW, MC_LY,
Expand All @@ -122,7 +121,7 @@ enum {
// Start macros for accented letters
ACCENT_MACRO_START,

MC_GV_A, MC_CR_A, MC_SQ_A, MC_QU,
MC_GV_A, MC_CR_A, MC_SQ_A, MC_QU, MC_AH,
MC_SQ_U, MC_CR_O, MC_SQ_O, MC_SQ_I,
MC_CR_E, MC_SQ_C, MC_SQ_E, MC_TL_A, MC_TL_O,

Expand Down Expand Up @@ -161,9 +160,10 @@ enum {
#define RCTLT_A RCTL_T(KC_A)

#define LALTT_P LALT_T(KC_P)
#define RALTT_H RALT_T(KC_H)
#define RALTT_F RALT_T(KC_F)

#define ALT_MAG RALT_T(KC_H)

#define LGUIT_T LGUI_T(KC_T)
#define RGUIT_R RGUI_T(KC_R)

Expand All @@ -178,8 +178,8 @@ enum {

#define NAV_F12 LT(_NAVIGATION, KC_F12)
#define NAV_AT LT(_NAVIGATION, KC_AT)
#define NAV_STI LT(_NAVIGATION, MC_STIN) // Hold behavior is implemented in intercepted code
#define NAV_MAG LT(_NAVIGATION, MAGIC)
#define NAV_STI LT(_NAVIGATION, MC_STIN) // Tap behavior is implemented in intercepted code
#define NAV_Q LT(_NAVIGATION, KC_Q)
#define NAV_REP LT(_NAVIGATION, REPEAT)
#define FNA_REP LT(_FIXED_NAV, REPEAT)

Expand Down Expand Up @@ -216,5 +216,6 @@ uint16_t extract_tapping_keycode(uint16_t keycode);
bool is_string_macro_keycode(uint16_t keycode);
bool is_shift_macro_keycode(uint16_t keycode);
bool is_accent_macro_keycode(uint16_t keycode);
bool is_shifted(void);

// clang-format on
16 changes: 8 additions & 8 deletions src/qmk/users/rafaelromao/definitions/keymap_blocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#define ________ALPHA1_R1____________________ KC_L , KC_O , KC_U , KC_Y
#define __________________ALPHA1_R2____________________ KC_Z , RGUIT_R , RCTLT_A , RSFTT_E , SHO_KCI
#define __________________ALPHA1_R3__________ KC_J , RALTT_H , TD_COMM , TD_DOT
#define __________________ALPHA1_R3__________ KC_J , ALT_MAG , TD_COMM , TD_DOT
#define ___ALPHA1_R4_____ RAI_A2 , MED_CAS

#define ___________________LOWER_L1__________ XXXXXXX , TD_LCBR , TD_RCBR , TD_BSLS
Expand All @@ -23,7 +23,7 @@
#define _________LOWER_R1____________________ KC_7 , KC_8 , KC_9 , XXXXXXX
#define ___________________LOWER_R2____________________ XXXXXXX , KC_4 , KC_5 , KC_6 , KC_DOT
#define ___________________LOWER_R3__________ XXXXXXX , KC_1 , KC_2 , KC_3
#define ____LOWER_R4_____ RAI_SPC , MED_0
#define ____LOWER_R4_____ SYM_SPC , MED_0

#define ___________________RAISE_L1__________ XXXXXXX , KC_F9 , KC_F8 , KC_F7
#define ___________________RAISE_L2____________________ XXXXXXX , KC_F6 , KC_F5 , KC_F4 , XXXXXXX
Expand All @@ -43,7 +43,7 @@
#define _________NUMPAD_R1___________________ KC_7 , KC_8 , KC_9 , XXXXXXX
#define ___________________NUMPAD_R2___________________ XXXXXXX , KC_4 , KC_5 , KC_6 , SHO_DOT
#define ___________________NUMPAD_R3_________ XXXXXXX , KC_1 , KC_2 , KC_3
#define ____NUMPAD_R4____ RAI_SPC , MED_0
#define ____NUMPAD_R4____ SYM_SPC , MED_0

#define ________________SHORTCUTS_L1_________ XXXXXXX , MC_CLOS , MC_Z0R , MC_PREV
#define ________________SHORTCUTS_L2___________________ MO_SYS , SF_MODM , MC_MODP , MC_TABS , XXXXXXX
Expand Down Expand Up @@ -75,14 +75,14 @@
#define ___________________NOMOD_R3__________ KC_J , KC_H , KC_COMM , KC_DOT
#define ____NOMOD_R4_____ OSL_A2 , OS_LSFT

#define ___________________ALPHA2_L1_________ XXXXXXX , KC_Q , MC_QU , KC_K
#define ___________________ALPHA2_L1_________ XXXXXXX , KC_H , MC_QU , KC_K
#define ___________________ALPHA2_L2___________________ KC_Y , KC_Z , KC_X , KC_W , XXXXXXX
#define _________ALPHA2_L3___________________ KC_J , MC_SQ_C , KC_V , XXXXXXX
#define ____ALPHA2_L4____ NAV_MAG , OS_SYM
#define ____ALPHA2_L4____ NAV_Q , OS_SYM

#define _________ALPHA2_R1___________________ MC_CR_O , MC_SQ_O , MC_SQ_U , XXXXXXX
#define ___________________ALPHA2_R2___________________ XXXXXXX , MC_TL_A , MC_SQ_A , MC_SQ_E , MC_SQ_I
#define ___________________ALPHA2_R3_________ XXXXXXX , MC_TL_O , MC_CR_A , MC_CR_E
#define _________ALPHA2_R1___________________ MC_CR_O , MC_CR_E , MC_CR_A , XXXXXXX
#define ___________________ALPHA2_R2___________________ XXXXXXX , MC_TL_A , MC_SQ_E , MC_SQ_A , MC_SQ_I
#define ___________________ALPHA2_R3_________ XXXXXXX , MC_TL_O , MC_SQ_O , MC_SQ_U
#define ____ALPHA2_R4____ _______ , MC_SQUO

#define _________________SYMBOLS_L1__________ XXXXXXX , KC_LCBR , KC_RCBR , KC_DLR
Expand Down
42 changes: 2 additions & 40 deletions src/qmk/users/rafaelromao/features/accents.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,47 +85,9 @@ process_record_result_t process_ngrams(uint16_t keycode, bool isShifted) {
tap_code(KC_Q);
tap_code(KC_U);
return PROCESS_RECORD_RETURN_FALSE;
case MC_ES:
tap_code(KC_E);
tap_code(KC_S);
return PROCESS_RECORD_RETURN_FALSE;
case MC_AO:
process_accents(MC_TL_A, NULL);
tap_code(KC_O);
return PROCESS_RECORD_RETURN_FALSE;
case MC_OES:
process_accents(MC_TL_O, NULL);
tap_code(KC_E);
tap_code(KC_S);
return PROCESS_RECORD_RETURN_FALSE;
case MC_NG:
tap_code(KC_N);
tap_code(KC_G);
return PROCESS_RECORD_RETURN_FALSE;
case MC_LY:
tap_code(KC_L);
tap_code(KC_Y);
return PROCESS_RECORD_RETURN_FALSE;
case MC_EY:
tap_code(KC_E);
tap_code(KC_Y);
return PROCESS_RECORD_RETURN_FALSE;
case MC_HY:
case MC_AH:
tap_code(KC_A);
tap_code(KC_H);
tap_code(KC_Y);
return PROCESS_RECORD_RETURN_FALSE;
case MC_OU:
tap_code(KC_O);
tap_code(KC_U);
return PROCESS_RECORD_RETURN_FALSE;
case MC_COM:
tap_code(KC_C);
tap_code(KC_O);
tap_code(KC_M);
return PROCESS_RECORD_RETURN_FALSE;
case MC_FIX_I:
tap_code(KC_BSPC);
SEND_STRING("I' ");
return PROCESS_RECORD_RETURN_FALSE;
}

Expand Down
Loading

0 comments on commit da576a6

Please sign in to comment.