diff --git a/adaptive_trailer.c b/adaptive_trailer.c new file mode 100644 index 0000000..d71bf71 --- /dev/null +++ b/adaptive_trailer.c @@ -0,0 +1,171 @@ +// +// adaptive_trailer.c +// +// +// Created by Alan on 1/22/24. +// +// +// embedded in the switch in adaptive.c +// + +// Using Adaptives for macros (like a flexible LeaderKey) +case ADAPTIVE_TRAILER: + + if (preprior_keycode) // allow only 1 deep + break; + return_state = false; // presume we do something. + switch (prior_keycode) { + #ifdef adaptAHASH + case KC_A: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptAHASH); // + break; + #endif + #ifdef adaptBHASH + case KC_B: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptBHASH); // + break; + #endif + #ifdef adaptCHASH + case KC_C: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptCHASH); // + break; + #endif + #ifdef adaptDHASH + case KC_D: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptDHASH); // + break; + #endif + #ifdef adaptEHASH + case KC_E: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptEHASH); // + break; + #endif + #ifdef adaptFHASH + case KC_F: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptFHASH); // + break; + #endif + #ifdef adaptGHASH + case KC_G: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptGHASH); // + break; + #endif + #ifdef adaptHHASH + case KC_H: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptHHASH); // + break; + #endif + #ifdef adaptIHASH + case KC_I: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptIHASH); // + break; + #endif + #ifdef adaptJHASH + case KC_J: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptJHASH); // + break; + #endif + #ifdef adaptKHASH + case KC_K: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptKHASH); // + break; + #endif + #ifdef adaptLHASH + case KC_L: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptLHASH); // + break; + #endif + #ifdef adaptMHASH + case KC_M: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptMHASH); // + break; + #endif + #ifdef adaptNHASH + case KC_N: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptNHASH); // + break; + #endif + #ifdef adaptOHASH + case KC_O: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptOHASH); // + break; + #endif + #ifdef adaptPHASH + case KC_P: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptPHASH); // + break; + #endif + #ifdef adaptRHASH + case KC_R: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptRHASH); // + break; + #endif + #ifdef adaptSHASH + case KC_S: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptSHASH); // + break; + #endif + #ifdef adaptTHASH + case KC_T: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptTHASH); // + break; + #endif + #ifdef adaptUHASH + case KC_U: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptUHASH); // + break; + #endif + #ifdef adaptVHASH + case KC_V: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptVHASH); // + break; + #endif + #ifdef adaptWHASH + case KC_W: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptWHASH); // + break; + #endif + #ifdef adaptXHASH + case KC_X: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptXHASH); // + break; + #endif + #ifdef adaptYHASH + case KC_Y: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptYHASH); // + break; + #endif + #ifdef adaptZHASH + case KC_Z: // + tap_code(KC_BSPC); // and may have been lowercase + send_string(adaptZHASH); // + break; + #endif + default: // + return_state = true; // didn't end up doing anything. + } + break; diff --git a/config.h b/config.h index 654fdc3..4363ca0 100644 --- a/config.h +++ b/config.h @@ -55,30 +55,11 @@ #define COMBO_HOLD (TAPPING_TERM) // time to hold to trigger delayed combo #endif - -#ifdef COMBO_HOLD - #undef ADAPTIVE_TERM - #define ADAPTIVE_TERM COMBO_HOLD // use COMBO_HOLD time as a standard threshold (same recation time) -#else - #define ADAPTIVE_TERM (TAPPING_TERM/5) // rolling threshold -#endif - -#define LINGER_TIME TAPPING_TERM * 1.2 // how long to hold before a time-depentant behavior begins -// how long to leave a state active before resetting like APPMENU or SHIFTWORD -#define STATE_RESET_TIME LINGER_TIME * 3 - -#define ADAPTIVE_ENABLE -#define ADAPTIVE_TRAILER KC_3 - -//#define THUMB_REPEATER -#ifdef THUMB_REPEATER -#define HD_REPEATER_A HD_BSPC -#define HD_REPEATER_B KC_ENT -#endif - +#define EN_HDIGRAPH_COMBOS // English H-Digraph combos (Th,Ch,Wh,Sh,Gh,Ph,Sch) #define EN_PRONOUN_COMBOS // English First Person pronoun combos (I, I'm, I've I'd I'll etc) (184 bytes on AVR) #define EN_PRONOUN_COMBOS_ALL // combos for you('ve), We('ve), They('ve) etc. (616 bytes on AVR) #define EN_W_PRONOUNS #define JP_MODE_ENABLE // Japanese mode features switch output for Japanese input (552 bytes on AVR) #define JP_YOUON_COMBOS // must have JP_MODE_ENABLE. min contracted sounds as combos (746 bytes on AVR) #define JP_YOUON_COMBOS_ALL // must have JP_YOUON_COMBOS. all contracted sounds as combos (862 bytes on AVR) + diff --git a/moutis.c b/moutis.c index 583e2d4..e03a9f0 100644 --- a/moutis.c +++ b/moutis.c @@ -14,15 +14,16 @@ uint8_t saved_mods = 0; // to pass state between process_record_user and matrix uint16_t record_keycode = 0; // the keykcode we poke at in process_record uint16_t key_trap = 0; // the actual keycode registered (need to unregister) #ifdef ADAPTIVE_ENABLE +uint16_t preprior_keycode = KC_NO; uint16_t prior_keycode = KC_NO; uint16_t prior_keydown = 0; // timer of keydown for adaptive threshhold. #endif uint16_t linger_key = 0; // keycode for linger actions (ex. "Qu") uint32_t linger_timer = 0; // time to hold a key before something else happens. -uint32_t state_reset_timer = 0; // time to leave a state active before shutting it down automatically. -bool appmenu_on = false; // state of windows-like app switcher -bool mods_held = false; // nood to remember how we entered the appmenu state +uint32_t appmenu_timer = 0; // time to leave appmenu active before shutting it down automatically. +bool appmenu_on = false; // appmenu triggered (after holding key) +bool mods_held = false; // need to remember how we entered the appmenu state #ifdef JP_MODE_ENABLE bool IS_ENGLISH_MODE = true; diff --git a/moutis.h b/moutis.h index d8c2f40..eaf077c 100644 --- a/moutis.h +++ b/moutis.h @@ -1,15 +1,5 @@ #pragma once -// -// which HD alpha variation are we using? -// -// defines all variation dependent constants/files/keycodes, etc. -// they will be used in the respective keymap for each keyboard - -#include "handsdown/vb-config.h" // definitions for the Alpha layer and mnemonic combos -#include "moutis_layers.h" // definitions for all the other layers - - #ifndef USERSPACE #define USERSPACE #endif @@ -51,6 +41,49 @@ extern rgblight_config_t rgblight_config; #define RGBLIGHT_VAL_STEP 4 #endif +// +// which HD alpha variation are we using? +// +// defines all variation dependent constants/files/keycodes, etc. +// they will be used in the respective keymap for each keyboard + +#include "personalizedmacros.h" + + +#ifdef THUMB_SHIFT +#include "handsdown/vb-config.ts.h" // definitions for the Alpha layer and mnemonic combos +#include "moutis_layers.ts.h" // definitions for all the other layers +#else +#include "handsdown/vb-config.h" // definitions for the Alpha layer and mnemonic combos +#include "moutis_layers.h" // definitions for all the other layers +#endif + + + +#define LINGER_TIME TAPPING_TERM * 1.2 // how long to hold before a time-depentant behavior begins +// how long to leave a state active before resetting like APPMENU or CAPSWORD +#define STATE_RESET_TIME LINGER_TIME * 3 + +//#define THUMB_SHIFT // use the thumb shift variant instead of index shift + + +#ifdef COMBO_HOLD + #undef ADAPTIVE_TERM + #define ADAPTIVE_TERM COMBO_HOLD * 1.35 // use COMBO_HOLD time as a standard threshold (same recation time) +#else + #define ADAPTIVE_TERM (TAPPING_TERM/4) // rolling threshold +#endif + +#define ADAPT_VOWEL_H // eliminate vowel SFBs (AU/UA;EO/OE) using vH instead of v' +#define ADAPTIVE_ENABLE +#define ADAPTIVE_TRAILER KC_3 +//#define FR_ADAPTIVES // eliminate 'h SFB for French + +//#define THUMB_REPEATER +#ifdef THUMB_REPEATER +#define HD_REPEATER_A HD_BSPC +#define HD_REPEATER_B KC_ENT +#endif #ifdef COMBO_ENABLE @@ -94,22 +127,27 @@ enum my_layers {// must be difined before semantickeys.h L_FUN, // 3 - function & number rows L_NUM, // 4 - numpad (right); navpad (left) L_NAV, // 5 - nav pad (right); meta keys (left) - L_CFG // 6 - Media/Consumer controls; Keyboard settings + L_CFG, // 6 - Media/Consumer controls; Keyboard settings + L_count }; enum OS_Platform { // Used for platform support via SemKeys OS_Mac, // Mac with ANSI_US_EXTENDED layout // OS_iOS, // iOS? OS_Win, // Win with default English/ANSI layout? -// OS_Lux, // Linux (Gnome?/KDE?) + OS_Lux, // Linux (Gnome?/KDE?) // OS_And, // Android (flavors?) OS_count }; #include "moutis_semantickeys.h" -#define register_linger_key(kc) {((kc > (uint16_t)SK_KILL) && (kc < (uint16_t)SemKeys_COUNT)) ? register_SemKey(kc) : register_code16(kc);linger_key = kc;linger_timer = state_reset_timer = timer_read();} +#define tap_HDkey(kc) {is_SemKey(kc) ? tap_SemKey(kc) : tap_code16(kc);} +#define register_HDkey(kc) {is_SemKey(kc) ? register_SemKey(kc) : register_code16(kc);} +#define unregister_HDkey(kc) {is_SemKey(kc) ? unregister_SemKey(kc) : unregister_code16(kc);} + +#define register_linger_key(kc) {register_HDkey(kc);linger_key = kc;linger_timer = timer_read();} +#define unregister_linger_key() {unregister_HDkey(linger_key) ;linger_key = 0;} -#define unregister_linger_key() {((linger_key > (uint16_t)SK_KILL) && (linger_key < (uint16_t)SemKeys_COUNT)) ? unregister_SemKey(linger_key) : unregister_code16(linger_key);linger_key = 0;} void matrix_scan_user_process_combo(void); diff --git a/moutis_ENCODER.c b/moutis_ENCODER.c index c01890e..bbfbc12 100644 --- a/moutis_ENCODER.c +++ b/moutis_ENCODER.c @@ -1,10 +1,9 @@ bool encoder_update_user(uint8_t index, bool clockwise) { - /* With an if statement we can check which encoder was turned. */ - uint8_t held_mods; - + static uint8_t held_mods; // static so we're not reallocating each time. + held_mods = get_mods(); // fetch mods - // Mod held Global (All layers) behaviors, all encoders + // Mod held Global (All layers) behaviors, all encoders if (held_mods & MOD_MASK_GUI) { // App switch // not platform saavy! if (held_mods & MOD_MASK_CTRL) { // workspace switch unregister_mods(MOD_MASK_SAG); // lift all but ctrl @@ -24,131 +23,149 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (held_mods & MOD_MASK_CTRL) { // just ctrl switch unregister_mods(MOD_MASK_SAG); // lift all but ctrl if (clockwise) { // Uses SemKey for Platform flexible app switch - tap_code16(C(KC_TAB)); // fwd - //tap_SemKey(SK_WINNXT); // Window/tab switcher Next + //tap_code16(C(KC_TAB)); // fwd + tap_SemKey(SK_WINNXT); // Window/tab switcher Next } else { - tap_code16(C(S(KC_TAB))); // fwd - //tap_SemKey(SK_WINPRV); // Window/tab switcher Prev + //tap_code16(C(S(KC_TAB))); // fwd + tap_SemKey(SK_WINPRV); // Window/tab switcher Prev } goto exit; } + +#ifndef no_enctbl + static uint16_t HD_enc[L_count][2][2][2] = { // [layer][L/R encoder][N/Y shift][ccw, cw] * uint16_t = 112 bytes + // all other encoder actions in this table, most of these defined in the meta keymap file moutis_layers.h + // currently using the keyboards bottom left and rightmost key defs for L/R encoder actions, as none + // of my keyboards have both these edge keys and encoders. + // ALL QMK keycodes work here, and HD extended keycodes, including SemKeys + // + // Left encoder Right encoder + // Unshifted Shifted Unshifted Shifted + // CCW, CW CCW, CW CCW, CW CCW, CW + {{{KC_VOLD,KC_VOLU}, {KC_BRID,KC_BRIU}}, {{KC_LEFT,KC_RIGHT}, {KC_UP, KC_DOWN}}}, // L_QWERTY, 0 - QWERTY compatibility layer + {{{KC_VOLD,KC_VOLU}, {KC_BRID,KC_BRIU}}, {{KC_LEFT,KC_RIGHT}, {KC_UP, KC_DOWN}}}, // L_HD, 1 - Hands Down Alpha layer + {{{LS_LH5,LS_LH4}, {LS_LH4,LS_LH5}}, {{LS_RH4,LS_RH5}, {LS_RH4,LS_RH5}}}, // L_SYM, 2 - symbols, punctuation, off-map alphas + {{{LF_LH5,LF_LH4}, {LF_LH4,LF_LH5}}, {{LF_RH4,LF_RH5}, {LF_RH4,LF_RH5}}}, // L_FUN, 3 - function & number rows + {{{LN_LH5,LN_LH4}, {LN_LH4,LN_LH5}}, {{LN_RH4,LN_RH5}, {LN_RH4,LN_RH5}}}, // L_NUM, 4 - numpad (right); navpad (left) + {{{LV_LH5,LV_LH4}, {LV_LH4,LV_LH5}}, {{LV_RH4,LV_RH5}, {LV_RH4,LV_RH5}}}, // L_NAV, 5 - nav pad (right); meta keys (left) + {{{LC_LH5,LC_LH4}, {LC_LH4,LC_LH5}}, {{LC_RH5,LC_RH4}, {LC_RH4,LC_RH5}}} // L_CFG 6 - Media/Consumer controls; Keyboard settings + }; + unregister_mods(MOD_MASK_SHIFT); // lift Shift, but leave all others (preserves capslock..) + // look up the keycode to send for this layer, encoder, shift state, direction + tap_HDkey(HD_enc[(int)get_highest_layer(layer_state)][(int)index][(int)((held_mods & MOD_MASK_SHIFT) ? 1 : 0)][(int)clockwise]); - if (!index) { /* First (left) encoder */ - switch(get_highest_layer(layer_state)){ - case L_SYM: // puncuation layer - case L_FUN: -volbright: - /* for audio scrub bk/fwd. */ - if ((held_mods & MOD_MASK_SHIFT)) { - if (clockwise) { - tap_code16(KC_BRIU); // Screen BRIGHTNESS UP - } else { - tap_code16(KC_BRID); // Screen BRIGHTNESS DN - } - } else { - if (clockwise) { - tap_code(KC_VOLU); // media vol up - } else { - tap_code(KC_VOLD); // media vol dn - } - } - goto exit; +#else // #ifdef no_enctbl + + if (!index) { /* First (left) encoder */ + switch(get_highest_layer(layer_state)){ + case L_SYM: // puncuation layer + case L_FUN: + volbright: + /* for audio scrub bk/fwd. */ + if ((held_mods & MOD_MASK_SHIFT)) { + if (clockwise) { + tap_code16(KC_BRIU); // Screen BRIGHTNESS UP + } else { + tap_code16(KC_BRID); // Screen BRIGHTNESS DN + } + } else { + if (clockwise) { + tap_code(KC_VOLU); // media vol up + } else { + tap_code(KC_VOLD); // media vol dn + } + } + goto exit; #ifdef L_NUM_SCAN - case L_NUM: // numpad layer (for navigating in spreadsheets) - if (clockwise) { - tap_code16(KC_RGHT); // - } else { - tap_code16(KC_LEFT); // - } - break; + case L_NUM: // numpad layer (for navigating in spreadsheets) + if (clockwise) { + tap_code16(KC_RGHT); // + } else { + tap_code16(KC_LEFT); // + } + break; #endif - case L_NAV: // nav layer - if (clockwise) { - tap_SemKey(SK_ZOOMIN); // ZOOM IN - } else { - tap_SemKey(SK_ZOOMOUT); // ZOOM OUT - } - break; - - #ifdef RGBLIGHT_ENABLE - case L_CFG: // media/kbd settings layer - if (clockwise) { - rgblight_increase_val(); // val (brightness) + - } else { - rgblight_decrease_val(); // val (brightness) - - } - break; - #endif - default: - if (clockwise) { - tap_code(KC_VOLU); // media vol up - } else { - tap_code(KC_VOLD); // media vol dn - } -/* - if (clockwise) { - tap_code(KC_RIGHT); // fwd - } else { - tap_code(KC_LEFT); // back - } - break; -*/ - - } - } else { // Second (right) encoder - switch(get_highest_layer(layer_state)){ - case L_SYM: // puncuation layer - goto volbright; - case L_FUN: // function layer - /* for audio scrub bk/fwd. */ - if (clockwise) { - tap_code(KC_MNXT); // media next track - } else { - tap_code(KC_MPRV); // media prev track - } - break; - case L_NUM: // numpad layer (for navigating in spreadsheets) - if (clockwise) { - tap_code16(KC_DOWN); // - } else { - tap_code16(KC_UP); // - } - break; - case L_NAV: // nav layer - if (clockwise) { - tap_SemKey(SK_HISTNXT); // prev page - } else { - tap_SemKey(SK_HISTPRV); // next page - } - break; + case L_NAV: // nav layer + if (clockwise) { + tap_SemKey(SK_ZOOMIN); // ZOOM IN + } else { + tap_SemKey(SK_ZOOMOUT); // ZOOM OUT + } + break; #ifdef RGBLIGHT_ENABLE - case L_CFG: // media/kbd settings layer - if ((held_mods & MOD_MASK_SHIFT)) { + case L_CFG: // media/kbd settings layer if (clockwise) { - rgblight_increase_sat(); // Sat + + rgblight_increase_val(); // val (brightness) + } else { - rgblight_decrease_sat(); // Sat - + rgblight_decrease_val(); // val (brightness) - } - } else { + break; +#endif + default: + if (clockwise) { + tap_code(KC_VOLU); // media vol up + } else { + tap_code(KC_VOLD); // media vol dn + } + + } + } else { // Second (right) encoder + switch(get_highest_layer(layer_state)){ + case L_SYM: // puncuation layer + goto volbright; + case L_FUN: // function layer + /* for audio scrub bk/fwd. */ + if (clockwise) { + tap_code(KC_MNXT); // media next track + } else { + tap_code(KC_MPRV); // media prev track + } + break; + case L_NUM: // numpad layer (for navigating in spreadsheets) if (clockwise) { - rgblight_increase_hue(); // Hue + + tap_code16(KC_DOWN); // + } else { + tap_code16(KC_UP); // + } + break; + case L_NAV: // nav layer + if (clockwise) { + tap_SemKey(SK_HISTNXT); // prev page } else { - rgblight_decrease_hue(); // Hue - + tap_SemKey(SK_HISTPRV); // next page } - } - break; + break; + +#ifdef RGBLIGHT_ENABLE + case L_CFG: // media/kbd settings layer + if ((held_mods & MOD_MASK_SHIFT)) { + if (clockwise) { + rgblight_increase_sat(); // Sat + + } else { + rgblight_decrease_sat(); // Sat - + } + } else { + if (clockwise) { + rgblight_increase_hue(); // Hue + + } else { + rgblight_decrease_hue(); // Hue - + } + } + break; #endif - default: - if (clockwise) { - tap_code(KC_RIGHT); // - } else { - tap_code(KC_LEFT); // - } - break; + default: + if (clockwise) { + tap_code(KC_RIGHT); // + } else { + tap_code(KC_LEFT); // + } + break; + } } - } +#endif // #ifdef no_enctbl exit: - set_mods(held_mods); // restore mods - return false; + set_mods(held_mods); // restore mods + return false; } + diff --git a/moutis_app_menu.c b/moutis_app_menu.c index 380791d..c9614ad 100644 --- a/moutis_app_menu.c +++ b/moutis_app_menu.c @@ -6,73 +6,54 @@ // matrix_APP_MENU checks/disables the timer. // // uses globals: -// uint32_t state_reset_timer = 0; // timer used for app_menu, adaptives, lingers +// uint32_t appmenu_timer = 0; // timer used for app_menu (0 = off) // uint8_t saved_mods = 0; // -// bool appmenu_on = false; // state of windows-like app switcher // bool mods_held = false; // nood to remember how we entered the appmenu state // void process_APP_MENU(keyrecord_t *record) { // KC_APP key gets special treatment - if (record->event.pressed) { - if (saved_mods & MOD_MASK_CTRL) { // cycle window w/in app (semkey?) - unregister_code(KC_RALT); // ignore these if ctrl - unregister_code(KC_RGUI); - tap_code(KC_TAB); - return; // handled this record. - } - mods_held = (saved_mods & (MOD_MASK_GUI | MOD_MASK_ALT)); // were mods held? - if (!mods_held) { // gui/alt not down, supply them - if (user_config.OSIndex) { // Can't SemKey this bc hold mods & timer... - register_code(KC_RALT); // Windows - } else { - register_code(KC_RGUI); // Mac - } - } -/* - if (saved_mods & MOD_MASK_SHIFT) - tap_code16(S(KC_TAB)); // switch app - else -*/ - layer_on(L_NAV); - tap_code(KC_TAB); // switch app - state_reset_timer = timer_read(); // (re)start timing hold for keyup below - return; // handled this record. - } - // up event - // if (mods_held || appmenu_on) // mods down, or already on… - if (appmenu_on) // mods down, or already on… - return; // so nothing to do here (matrix_APP_MENU will handle it) - if (timer_elapsed(state_reset_timer) > LINGER_TIME) { // held long enough? - appmenu_on = true; // Y:turn on menu (taken down in matrix_scan_user) - state_reset_timer = timer_read(); // start timer - } else { // N: just a quick tap for app switch. - if (user_config.OSIndex) { // let mod keys up now - unregister_code(KC_RALT); // Win - } else { - unregister_code(KC_RGUI); // Mac - } - layer_off(L_NAV); - state_reset_timer = 0; // stop the timer - } - return; // handled this record. -} - - -// -// somewhere in matrix_scan_user (early?) -// -void matrix_APP_MENU(void) { - if (appmenu_on) { // App menu up, (no mods) check if it needs to be cleared - if (timer_elapsed(state_reset_timer) > STATE_RESET_TIME) {// menu up time elapsed? - if (user_config.OSIndex) { // Y. stop the menu by lifting the mods - unregister_code(KC_RALT); // Win + disable_caps_word(); // turn off CAPS_WORD + prior_keycode = preprior_keycode = prior_keydown = 0; // turn off Adaptives. + if (record->event.pressed) { + if (saved_mods & MOD_MASK_CTRL) { // cycle window w/in app + unregister_code(KC_RALT); // ignore these if ctrl + unregister_code(KC_RGUI); + tap_code(KC_TAB); + return; // handled this record. + } + mods_held = (saved_mods & (MOD_MASK_GUI | MOD_MASK_ALT)); // were mods held? + if (!mods_held) { // gui/alt not down, supply them + if (user_config.OSIndex) { // Can't SemKey this bc hold mods & timer... + register_code(KC_RALT); // Win/Lux } else { - unregister_code(KC_RGUI); // Mac + register_code(KC_RGUI); // Mac } - layer_off(L_NAV); - state_reset_timer = mods_held = 0; // stop the timer - appmenu_on = false; } + + if (saved_mods & MOD_MASK_SHIFT) + tap_code16(S(KC_TAB)); // switch app + else + tap_code(KC_TAB); // switch app + layer_on(L_NAV); + appmenu_timer = timer_read(); // (re)start timing hold for keyup below + return; // handled this record. + } + // up event + if (appmenu_on) // mods down, or already on… + return; // so nothing to do here (matrix_APP_MENU will handle it) + if (timer_elapsed(appmenu_timer) > LINGER_TIME) { // held long enough? + appmenu_timer = timer_read(); // Y:start timer (take down in matrix_scan_user) + appmenu_on = true; + } else { // N: just a quick tap for app switch. + if (user_config.OSIndex) { // let mod keys up now + unregister_code(KC_RALT); // Win/Lux + } else { + unregister_code(KC_RGUI); // Mac + } + layer_off(L_NAV); + appmenu_on = false; + appmenu_timer = 0; // stop the timer } + return; // handled this record. } diff --git a/moutis_casemods.c b/moutis_casemods.c index 8061fe6..219a79f 100644 --- a/moutis_casemods.c +++ b/moutis_casemods.c @@ -33,25 +33,32 @@ // bools to keep track of the caps word state -static bool caps_word_on = false; +static uint32_t caps_word_timer = 0; static bool last_press_was_space = false; +/* +bool caps_word_on (void) { + if (caps_word_timer) + return true; + return false; +} +*/ // Enable caps word void enable_caps_word(void) { - caps_word_on = true; last_press_was_space = false; if (!host_keyboard_led_state().caps_lock) { tap_code(KC_CAPS); } - state_reset_timer = timer_read(); // (re)start timing hold for keyup below + caps_word_timer = timer_read(); // (re)start timing hold for keyup below } // Disable caps word void disable_caps_word(void) { - caps_word_on = false; + caps_word_timer = 0; if (last_press_was_space) { tap_code(KC_BSPC); + tap_code16(KC_SPC); } if (host_keyboard_led_state().caps_lock) { tap_code(KC_CAPS); @@ -60,7 +67,7 @@ void disable_caps_word(void) { // Toggle caps word void toggle_caps_word(void) { - if (caps_word_on) { + if (caps_word_timer) { disable_caps_word(); } else { @@ -87,13 +94,13 @@ bool process_caps_word(uint16_t keycode, const keyrecord_t *record) { } */ if (record->event.pressed) { - keycode = keycode & QK_BASIC_MAX; // process the base key + keycode = keycode & QK_BASIC_MAX; // process just the base key // check if the case modes have been terminated if ((get_mods() != 0)) { // hitting any mod...go handle it disable_caps_word(); return true; // let QMK handle it. } - state_reset_timer = timer_read(); // (re)start timing hold for auto-off delay + caps_word_timer = timer_read(); // (re)start timing hold for auto-off delay switch (keycode) { case KC_1 ... KC_0: // let these pass through case KC_MINS: @@ -107,28 +114,30 @@ bool process_caps_word(uint16_t keycode, const keyrecord_t *record) { disable_caps_word(); return true; // let QMK handle space normally } else { - register_code16(KC_UNDS); + tap_code16(KC_UNDS); last_press_was_space = true; return false; // We handled it } - break; // compiler takes this out if necessary? case KC_A ... KC_Z: // only works for ASCII. fix this. register_code(KC_LSFT); // for platforms that do CAPSLK differently - register_code(keycode); // like iOS, etc. + tap_code(keycode); // like iOS, etc. unregister_code(KC_LSFT); last_press_was_space = false; return false; // We handled it } - disable_caps_word(); + disable_caps_word(); // didn't encounter a legit caps char, so off. return true; - } else { + } +/* + else { switch (keycode) { case KC_SPC: if (last_press_was_space) { - unregister_code16(KC_UNDS); + //unregister_code16(KC_UNDS); return false; // We handled it } } } // end if event.pressed +*/ return true; // keep processing } diff --git a/moutis_casemods_a.c b/moutis_casemods_a.c new file mode 100644 index 0000000..956b6e5 --- /dev/null +++ b/moutis_casemods_a.c @@ -0,0 +1,154 @@ +/* Copyright 2021 Andrew Rae ajrae.nv@gmail.com @andrewjrae + * + * 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 . + */ + +/* The caps word concept started with @iaap on splitkb.com discord. + * However it has been implemented and extended by many splitkb.com users: + * - @theol0403 made many improvements to initial implementation + * - @precondition used caps lock rather than shifting + * - @dnaq his own implementation which also used caps lock + * - @sevanteri added underscores on spaces + * - @metheon extended on @sevanteri's work and added specific modes for + * snake_case and SCREAMING_SNAKE_CASE + * - @baffalop came up with the idea for xcase, which he implements in his own + * repo, however this is implemented by @iaap with support also for one-shot-shift. + * - @sevanteri + * - fixed xcase waiting mode to allow more modified keys and keys from other layers. + * - Added @baffalop's separator defaulting on first keypress, with a + * configurable default separator and overrideable function to determine + * if the default should be used. + */ + + +// bools to keep track of the caps word state +static uint32_t caps_word_timer = 0; +static bool last_press_was_space = false; + +// Check whether caps word is on +bool caps_word_enabled(void) { +if (caps_word_timer) + return true; + return false; +} + +// Enable caps word +void enable_caps_word(void) { + + caps_word_timer = true; + if (!host_keyboard_led_state().caps_lock) { + tap_code(KC_CAPS); + } + caps_word_timer = timer_read(); // (re)start timing hold for keyup below +} + +// Disable caps word +void disable_caps_word(void) { + caps_word_timer = 0; + if (last_press_was_space) { + tap_code(KC_BSPC); + last_press_was_space = false; + } + if (host_keyboard_led_state().caps_lock) { + tap_code(KC_CAPS); + } +} + +// Toggle caps word +void toggle_caps_word(void) { + if (caps_word_timer) { + disable_caps_word(); + } + else { + enable_caps_word(); + } +} + +// overrideable function to determine whether the case mode should stop +__attribute__ ((weak)) +bool terminate_caps_word(uint16_t keycode, const keyrecord_t *record) { + switch (keycode) { // should only be called on event.pressed + // Keycodes to ignore (don't disable caps word) + case KC_A ... KC_Z: // only works for ASCII. fix this. + case KC_1 ... KC_0: // let the rest of these pass through + case KC_MINS: + case KC_UNDS: + case KC_BSPC: + case KC_RIGHT ... KC_LEFT: + last_press_was_space = false; + case KC_SPC: + caps_word_timer = timer_read(); // (re)start timing hold for auto-off delay + if ((get_mods() != 0)) { // hitting any mod...go handle it + return true; + } + break; + default: + return true; + break; + } + return false; +} + +bool process_caps_word(uint16_t keycode, const keyrecord_t *record) { + + if (caps_word_timer) { + // Filter out the actual keycode from MT and LT keys. + // This isn't working right. need to allow a layer to happen. + switch (keycode) { + case QK_MOD_TAP ... QK_MOD_TAP_MAX: + case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: + case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: + if (record->tap.count == 0) // if not tapped yet… + return true; // do that first + keycode = keycode & 0xFF; // process the base key + default: + break; + } + + if (record->event.pressed) { + // check if the case modes have been terminated + if ((terminate_caps_word(keycode, record))) { + disable_caps_word(); + } else { // CAPS_WORD_IS_ON. + switch (keycode) { + case KC_SPC: + if (last_press_was_space) { + disable_caps_word(); + return true; // let QMK handle space normally + } else { + register_code16(KC_UNDS); + last_press_was_space = true; + return false; // We handled it + } + break; // compiler takes this out if necessary? + case KC_A ... KC_Z: // only works for ASCII. fix this. +// register_code(KC_LSFT); // for platforms that do CAPSLK differently + register_code(keycode); // like iOS, etc. +// unregister_code(KC_LSFT); + return false; // We handled it + } + } + } else { + switch (keycode) { + case KC_SPC: + if (last_press_was_space) { + unregister_code16(KC_UNDS); + return false; // We handled it + } + } + } // end if event.pressed + return true; // keep processing + } + return true; +} diff --git a/moutis_combo.c b/moutis_combo.c index b1752cb..18f974b 100644 --- a/moutis_combo.c +++ b/moutis_combo.c @@ -82,6 +82,7 @@ void process_combo_event(uint16_t combo_index, bool pressed) { combo_on = combo_index; // if held, addd 'h' for "Sch" in matrix_scan_user_process_combo break; */ +#ifdef EN_HDIGRAPH_COMBOS case HC_Sch: // to avoid outward roll on ring->pinky fingers moving in unison is easier tap_code(KC_S); // send "S" unregister_mods(MOD_MASK_SHIFT); // @@ -97,6 +98,7 @@ void process_combo_event(uint16_t combo_index, bool pressed) { tap_code(KC_P); // send "P" honoring caps combo_on = combo_index; // if held, check in matrix_scan_user_process_combo break; +#endif // EN_HDIGRAPH_COMBOS case HC_ACUT: @@ -235,7 +237,6 @@ void process_combo_event(uint16_t combo_index, bool pressed) { // so keep together 'cause we're messing with stack frames at the end! case HC_they_4gram: // "they" -// case HC_theyg_4gram: // "they" tap_code(KC_T); // send "Y" honoring caps unregister_mods(MOD_MASK_SHIFT); // send_string("hey"); // send "they" right away @@ -275,7 +276,7 @@ void process_combo_event(uint16_t combo_index, bool pressed) { #endif // #ifdef EN_PRONOUN_COMBOS_ALL -addonsuffix: // sharing this saves about 100 bytes (10 bytes per instance) +addonsuffix: // sharing this saves about 100 bytes on AVR (10 bytes per instance) tap_code(KC_QUOT); switch (combo_index) { // case HC_Im: @@ -556,7 +557,7 @@ void process_combo_event(uint16_t combo_index, bool pressed) { #endif switch(combo_index) { // the H digraphs - +#ifdef EN_HDIGRAPH_COMBOS case HC_Sch: // to avoid outward roll on ring->pinky fingers moving in unison is easier case HC_Ch: case HC_Th: @@ -567,8 +568,7 @@ void process_combo_event(uint16_t combo_index, bool pressed) { unregister_mods(MOD_MASK_SHIFT); // tap_code(KC_H); // send "h" honoring CAPSLK state break; - -// END the H digraphs +#endif // EN_HDIGRAPH_COMBOS case HC_FIND: // Simple Find if not held tap_SemKey(SK_FIND); @@ -707,11 +707,9 @@ void matrix_scan_user_process_combo() { // called from matrix_scan_user if comb // Checking combo_triggered above can enable sending untriggered keys // and thus allow for longer COMBO_TERM. (recommend < TAPPING_TERM / 2) // still, really fast rolls, esp if they can go both ways, are going to be - // a problem for this (ex er, re; io oi), so maybe best to avoid them as - // combos. On Hands Down, this means no combos on home row, but that's fine, - // because home already has modifiers, so it all works out. - // - // I've since successfully added COMBO_HOLD Home Row combos without difficulty. + // a problem for this (ex er, re; io oi on qwerty), so maybe best to avoid them as + // combos. + // I've successfully added COMBO_HOLD Home Row combos without difficulty. // To use multiple home row mods, just put them down one at a time...works great. // if (!combo_triggered) { @@ -740,7 +738,7 @@ void matrix_scan_user_process_combo() { // called from matrix_scan_user if comb tap_SemKey(SK_PSTM); break; - +#ifdef EN_HDIGRAPH_COMBOS case HC_Sh: // if these H digragh combos are held, then send T/SION instead case HC_Th: // TION = by far most common 4-gram, (then THAT/THER/WITH/MENT) unregister_mods(MOD_MASK_SHIFT); @@ -765,6 +763,8 @@ void matrix_scan_user_process_combo() { // called from matrix_scan_user if comb // case HC_Sc: // // tap_code(KC_H); // add "h" (for "Sch", since were already on these keys.) // break; +#endif // EN_HDIGRAPH_COMBOS + case HC_AT: send_string(At_ComboHeld); break; diff --git a/moutis_combo.h b/moutis_combo.h index bf4a880..042a931 100644 --- a/moutis_combo.h +++ b/moutis_combo.h @@ -8,8 +8,6 @@ // #define HD_combo_def "moutis_combo_def.c" -#include "personalizedmacros.h" - #ifndef At_ComboHeld #define At_ComboHeld ".com" #endif @@ -117,6 +115,7 @@ enum my_combos { // Fast entry 4grams // since combos are a bit slower, // needs to be a 4gram+ or more to be worth it +#ifdef EN_HDIGRAPH_COMBOS HC_Th, // treat as θ HC_Sh, // TYPE "sh" HC_Wh, // treat as digraph 'WH' @@ -124,6 +123,7 @@ enum my_combos { HC_Gh, // treat as digraph 'GH' HC_Ph, // treat as φ HC_Sch, // treat as digraph 'SCH' +#endif // EN_HDIGRAPH_COMBOS #ifdef EN_PRONOUN_COMBOS // Pronoun combos. KEEP these together! diff --git a/moutis_combo_def.c b/moutis_combo_def.c index ecfcac3..ed5b354 100644 --- a/moutis_combo_def.c +++ b/moutis_combo_def.c @@ -20,10 +20,13 @@ const uint16_t PROGMEM HC_cfg_combo[] = {HD_RH1, HD_RH2, COMBO_END}; // keyboard settings/config layer #ifdef APPMENU_keys const uint16_t PROGMEM H_menu_combo[] = {APPMENU_keys, COMBO_END}; // AppMENU -const uint16_t PROGMEM H_menu_nav_combo[] = {APPMENU_nav_keys, COMBO_END}; // AppMENU #else const uint16_t PROGMEM H_menu_combo[] = {HD_LB3, HD_LB1, COMBO_END}; // AppMENU // default Appmenu location -const uint16_t PROGMEM H_menu_nav_combo[] = {LN_LB3, LN_LB1, COMBO_END}; // AppMENU on Nav layer +#endif +#ifdef APPMENU_nav_keys +const uint16_t PROGMEM H_menu_nav_combo[] = {APPMENU_nav_keys, COMBO_END}; // AppMENU on Nav layer +#else +const uint16_t PROGMEM H_menu_nav_combo[] = {LV_LT1, LV_LT0, COMBO_END}; // AppMENU on Nav layer #endif // Spatially arranged on the QWERTY ZXCV locations diff --git a/moutis_layers.h b/moutis_layers.h index 52b89de..8115f34 100644 --- a/moutis_layers.h +++ b/moutis_layers.h @@ -20,15 +20,16 @@ // ╰───────────╮ LH2 LH1 │ LH0 LHA RHA RH0 │ RH1 RH2 ╭───────────╯ // LH5 LH4 LH3 ╰─────────╯ ╰─────────╯ RH3 RH4 RH5 - +// LH5, LH4 are also Left encoder CCW, CW +// RH5, RH4 are also Right encoder CCW, CW /* L_SYM Symbols and punctuation (Some via SemKeys/unicode for platform independance) - ╭──────────────────────────────────────────╮ ╭──────────────────────────────────────────╮ -__ │ Z Q ¶ § ‡ │ │ ¢ $ € £ ¥ │ __ -__ │ < [ ( { † | | ¡ * = + / │ __ -__ │ > ] ) } • │ __ __ __ __ │ _ | & ^ % │ __ - ╰──────────────────╮ VolD D_WordL D_WordR │ VolU __ │ ª ° · ╭─────────────╯ - HISTPRV HISTNXT ╰───────────────────────╯ ╰────────────────────────────╯ ZOOMRST ZOOMOUT + ╭────────────────────────────────────────────╮ ╭──────────────────────────────────────────╮ +__ │ Z Q ¶ § ‡ │ │ ¢ $ € £ ¥ │ __ +__ │ < [ ( { † | | ¡ * = + / │ __ +__ │ > ] ) } • │ __ __ __ __ │ _ | & ^ % │ __ + ╰──────────────────╮ VolD D_WordL D_WordR │ -- __ │ ª ° · ╭─────────────╯ + KC_PGDN KC_PGUP ╰─────────────────────────╯ ╰────────────────────────────╯ SK_WORDPRV SK_WORDNXT */ #define LS_LT5 KC_TRNS @@ -74,20 +75,20 @@ __ │ > ] ) } • │ __ __ __ __ │ _ #define LS_RB4 KC_PERC #define LS_RB5 KC_TRNS -#define LS_LH5 KC_TRNS -#define LS_LH4 KC_TRNS -#define LS_LH3 KC_VOLD +#define LS_LH5 KC_PGDN // also left encoder CCW +#define LS_LH4 KC_PGUP // also left encoder CW +#define LS_LH3 KC_MUTE #define LS_LH2 SK_DELWDL #define LS_LH1 SK_DELWDR -#define LS_LH0 KC_VOLU -#define LS_LHA KC_VOLU -#define LS_RHA KC_NO +#define LS_LH0 KC_VOLD +#define LS_LHA KC_VOLD +#define LS_RHA KC_VOLU #define LS_RH0 KC_VOLU #define LS_RH1 LALT(KC_9) // ª #define LS_RH2 LSA(KC_8) // ° #define LS_RH3 LSA(KC_9) // · -#define LS_RH4 KC_TRNS -#define LS_RH5 KC_TRNS +#define LS_RH4 SK_WORDPRV // also right encoder CCW +#define LS_RH5 SK_WORDNXT // also right encoder CW /* L_FUN LAYER K-key row (left) and Num row (right) @@ -118,7 +119,7 @@ __ │ > ] ) } • │ __ __ __ __ │ _ #define LF_LM2 LGUI_T(KC_F7) #define LF_LM1 LSFT_T(KC_F8) #define LF_LM0 KC_F14 -#define LF_RM0 KC_COMM +#define LF_RM0 KC_ASTR #define LF_RM1 RSFT_T(KC_1) #define LF_RM2 RGUI_T(KC_2) #define LF_RM3 RALT_T(KC_3) @@ -142,8 +143,8 @@ __ │ > ] ) } • │ __ __ __ __ │ _ #define LF_RB4 KC_EQL #define LF_RB5 RGB_HUD -#define LF_LH5 KC_TRNS -#define LF_LH4 KC_TRNS +#define LF_LH5 KC_TRNS // also left encoder CCW +#define LF_LH4 KC_TRNS // also left encoder CW #define LF_LH3 KC_TRNS #define LF_LH2 KC_SCLN #define LF_LH1 TG(L_NUM) @@ -154,11 +155,11 @@ __ │ > ] ) } • │ __ __ __ __ │ _ #define LF_RH1 KC_0 #define LF_RH2 KC_DOT #define LF_RH3 KC_TRNS -#define LF_RH4 SK_ZOOMRST -#define LF_RH5 KC_TRNS +#define LF_RH4 KC_MPRV // also right encoder CCW +#define LF_RH5 KC_MNXT // also right encoder CW -/* L_Nav Navigation (left) NUMPad Layer (right) (LN) +/* L_NUM Navigation (left) NUMPad Layer (right) (LN) ╭──────────────────────────────────────────╮ ╭──────────────────────────────────────────╮ __ │ NUM_LK PGUP UP PGDN TAB │ │ PSLS P7 P8 P9 PMNS │ __ __ │ W_LEFT LEFT DOWN RGHT W_RGHT | | PAST P4 P5 P6 PPLS │ __ @@ -210,8 +211,8 @@ __ │ UNDO CUT COPY PSTE SPC │ __ __ __ __ │ PCMM #define LN_RB4 KC_PEQL #define LN_RB5 KC_TRNS -#define LN_LH5 KC_TRNS -#define LN_LH4 KC_TRNS +#define LN_LH5 KC_TRNS // also left encoder CCW +#define LN_LH4 KC_TRNS // also left encoder CW #define LN_LH3 KC_TRNS #define LN_LH2 LGUI_T(KC_BSPC) #define LN_LH1 LSFT_T(KC_ENT) @@ -222,8 +223,9 @@ __ │ UNDO CUT COPY PSTE SPC │ __ __ __ __ │ PCMM #define LN_RH1 KC_P0 #define LN_RH2 KC_PDOT #define LN_RH3 KC_TRNS -#define LN_RH4 KC_TRNS -#define LN_RH5 KC_TRNS +#define LN_RH4 SK_HISTPRV // also left encoder CCW +#define LN_RH5 SK_HISTNXT // also right encoder CW + /* L_NAV THE NAVIGATION (right hand) LAYER w/ edit & mods on left ╭──────────────────────────────────────────╮ ╭───────────────────────────────────────────────╮ @@ -231,7 +233,7 @@ __ │ QUIT CLOZ SCAP SCLP PSTM │ │ DOCBEG __ │ LCTL LALT LGUI LSFT FIND | | WORDPRV LEFT DOWN RGHT WORDNXT │ __ __ │ UNDO CUT COPY PSTE FAGN │ __ __ __ __ │ DOCEND END DOWN PGDN PARANXT │ __ ╰──────────────────╮ __ S(MENU) MENU │ __ __ │ HISTPRV HISTNXT __ ╭──────────────────╯ - HISTPRV HISTNXT ╰───────────────────────╯ ╰────────────────────────────╯ ZOOMRST ZOOMOUT + ZOOMRST ZOOMOUT ╰───────────────────────╯ ╰────────────────────────────╯ HISTPRV HISTNXT */ #define LV_LT5 KC_TRNS @@ -245,7 +247,7 @@ __ │ UNDO CUT COPY PSTE FAGN │ __ __ __ __ │ DOCEND #define LV_RT2 KC_UP #define LV_RT3 KC_PGUP #define LV_RT4 SK_PARAPRV -#define LV_RT5 KC_NUM +#define LV_RT5 KC_TRNS #define LV_LM5 KC_VOLU #define LV_LM4 KC_LCTL @@ -277,33 +279,36 @@ __ │ UNDO CUT COPY PSTE FAGN │ __ __ __ __ │ DOCEND #define LV_RB4 SK_PARANXT #define LV_RB5 KC_TRNS -#define LV_LH5 KC_TRNS -#define LV_LH4 SK_ZOOMRST -#define LV_LH3 KC_TRNS -#define LV_LH2 S(KC_APP) -#define LV_LH1 KC_APP +#define LV_LH5 SK_ZOOMOUT // also left encoder CCW +#define LV_LH4 SK_ZOOMIN // also left encoder CW +#define LV_LH3 KC_APP // *** APPMENU needs this for navigation *** +#define LV_LH2 S(KC_APP) // APPMENU +#define LV_LH1 KC_APP // APPMENU #define LV_LH0 KC_NO #define LV_LHA KC_NO -#define LV_RHA KC_NO +#define LV_RHA SK_ZOOMRST #define LV_RH0 SK_ZOOMOUT #define LV_RH1 SK_HISTPRV #define LV_RH2 SK_HISTNXT -#define LV_RH3 SK_ZOOMIN -#define LV_RH4 SK_ZOOMRST -#define LV_RH5 KC_TRNS - -/* L_CFG Keyboard Configuration (left) and Media Settings (right) - __no__, QK_RBT, CG_SWAP, CG_NORM, EE_CLR, LCA(KC_DEL), SK_KILL, KC_NUM, KC_EJCT, __no__, SK_ZOOMRST, RGB_MOD, - RGB_VAI, HD_AdaptKeyToggle, HD_L_QWERTY, HD_L_ALPHA, KC_VOLU, KC_BRIU, __no__, KC_MPRV, KC_MUTE, KC_MNXT, SK_ZOOMOUT, RGB_SAI, - RGB_HUI, QK_BOOT, AG_SWAP, AG_NORM, KC_VOLD, KC_BRID, RGB_VAD, __no__, __no__, RGB_SAD, __no__, KC_MRWD, KC_MPLY, KC_MFFD, SK_ZOOMIN, RGB_HUD, - __no__, __no__, __no__, TG(L_NUM), __no__, __no__, __no__, __no__, __no__, __no__) +#define LV_RH3 KC_NUM +#define LV_RH4 SK_PARAPRV // also right encoder CCW +#define LV_RH5 SK_PARANXT // also right encoder CW + + +/* L_CFG Keyboard Configuration (left) and Media Settings (right) + ╭──────────────────────────────────────────╮ ╭───────────────────────────────────────────────╮ + __ │ SK_Lux SK_Win SK_Mac QK_RBT SK_KILL │ │ (C(A(del)))KC_NUM KC_EJCT KC_NO SK_ZOOMRST │ RGB_MOD + RGB_VAI │ HD_AKTg L_0 L_1 KC_VOLU KC_BRIU | | KC_NO KC_MPRV KC_MUTE KC_MNXT SK_ZOOMOUT │ RGB_SAI + RGB_HUI │ QK_BOOT AG_SWAP AG_NORM KC_VOLD KC_BRID │ RGB_VAD __ __ RGB_SAD │ KC_NO KC_MRWD KC_MPLY KC_MFFD SK_ZOOMIN │ RGB_HUD + ╰──────────────────╮ __ __ EE_CLR │ __ __ │ __ __ __ ╭──────────────────╯ + __ __ ╰───────────────────────╯ ╰────────────────────────────╯ __ __ */ #define LC_LT5 KC_NO -#define LC_LT4 QK_RBT -#define LC_LT3 CG_SWAP -#define LC_LT2 CG_NORM -#define LC_LT1 EE_CLR +#define LC_LT4 SK_Lux +#define LC_LT3 SK_Win +#define LC_LT2 SK_Mac +#define LC_LT1 QK_RBT #define LC_LT0 SK_KILL #define LC_RT0 LCA(KC_DEL) #define LC_RT1 KC_NUM @@ -332,8 +337,8 @@ __ │ UNDO CUT COPY PSTE FAGN │ __ __ __ __ │ DOCEND #define LC_LB1 KC_VOLD #define LC_LB0 KC_BRID #define LC_LBA RGB_VAD -#define LC_LBB KC_NO -#define LC_RBB KC_NO +#define LC_LBB SK_ZOOMIN +#define LC_RBB SK_ZOOMOUT #define LC_RBA RGB_SAD #define LC_RB0 KC_NO #define LC_RB1 KC_MRWD @@ -342,16 +347,18 @@ __ │ UNDO CUT COPY PSTE FAGN │ __ __ __ __ │ DOCEND #define LC_RB4 SK_ZOOMIN #define LC_RB5 RGB_HUD -#define LC_LH4 KC_NO -#define LC_LH3 KC_NO -#define LC_LH2 KC_NO -#define LC_LH1 TG(L_NUM) -#define LC_LH0 KC_NO -#define LC_LHA KC_NO -#define LC_RHA KC_NO +#define LC_LH5 KC_BRID // also left encoder CCW +#define LC_LH4 KC_BRIU // also left encoder CW +#define LC_LH3 KC_MUTE +#define LC_LH2 KC_VOLD +#define LC_LH1 KC_VOLU +#define LC_LH0 EE_CLR +#define LC_LHA SK_ZOOMIN +#define LC_RHA SK_ZOOMOUT #define LC_RH0 KC_NO #define LC_RH1 KC_NO #define LC_RH2 KC_NO #define LC_RH3 KC_NO -#define LC_RH4 KC_NO +#define LC_RH4 KC_NO // also right encoder CCW +#define LC_RH5 KC_NO // also right encoder CW diff --git a/moutis_layers.ts.h b/moutis_layers.ts.h new file mode 100644 index 0000000..0a91ac2 --- /dev/null +++ b/moutis_layers.ts.h @@ -0,0 +1,357 @@ +// +// moutis_layers.h +// +// +// Created by Alan on 6/23/23. +// + +#ifndef moutis_layers_h +#define moutis_layers_h +#endif /* moutis_layers_h */ + + +// Key Position Names for a 34 (-54) key split form factor +// Should cover ergo boards Ferris through Atreus-Kyria-Ergodox +// and orthos like plank and Naked48 +// ╭─────────────────────╮ ╭─────────────────────╮ +// LT5 │ LT4 LT3 LT2 LT1 LT0 │ LTA RTB │ RT0 RT1 RT2 RT3 RT4 │ RT5 +// LM5 │ LM4 LM3 LM2 LM1 LM0 | LMA RMA | RT0 RM1 RM2 RM3 RM4 │ RM5 +// LB5 │ LB4 LB3 LB2 LB1 LB0 │ LBA LBB RBB RBA │ RB0 RB1 RB2 RB3 RB4 │ RB5 +// ╰───────────╮ LH2 LH1 │ LH0 LHA RHA RH0 │ RH1 RH2 ╭───────────╯ +// LH5 LH4 LH3 ╰─────────╯ ╰─────────╯ RH3 RH4 RH5 + + + +/* L_SYM Symbols and punctuation (Some via SemKeys/unicode for platform independance) + ╭──────────────────────────────────────────╮ ╭──────────────────────────────────────────╮ +__ │ Z Q ¶ § ‡ │ │ ¢ $ € £ ¥ │ __ +__ │ < [ ( { † | | ¡ * = + / │ __ +__ │ > ] ) } • │ __ __ __ __ │ _ | & ^ % │ __ + ╰──────────────────╮ VolD D_WordL D_WordR │ VolU __ │ ª ° · ╭─────────────╯ + HISTPRV HISTNXT ╰───────────────────────╯ ╰────────────────────────────╯ ZOOMRST ZOOMOUT +*/ + +#define LS_LT5 KC_TRNS +#define LS_LT4 KC_Z +#define LS_LT3 KC_Q +#define LS_LT2 SK_PARA +#define LS_LT1 SK_SECT +#define LS_LT0 SK_DCRS +#define LS_RT0 SK_CENT +#define LS_RT1 KC_DLR +#define LS_RT2 SK_EURO +#define LS_RT3 SK_BPND +#define LS_RT4 SK_JPY +#define LS_RT5 KC_TRNS + +#define LS_LM5 KC_TRNS +#define LS_LM4 KC_LT +#define LS_LM3 KC_LBRC +#define LS_LM2 KC_LPRN +#define LS_LM1 KC_LCBR +#define LS_LM0 SK_SCRS +#define LS_RM0 SK_IEXC +#define LS_RM1 KC_PAST +#define LS_RM2 RGUI_T(KC_PEQL) +#define LS_RM3 RALT_T(KC_PPLS) +#define LS_RM4 RCTL_T(KC_PSLS) +#define LS_RM5 KC_TRNS + +#define LS_LB5 KC_TRNS +#define LS_LB4 KC_GT +#define LS_LB3 KC_RBRC +#define LS_LB2 KC_RPRN +#define LS_LB1 KC_RCBR +#define LS_LB0 LALT(KC_8) +#define LS_LBA KC_TRNS +#define LS_LBB KC_TRNS +#define LS_RBB KC_TRNS +#define LS_RBA KC_TRNS +#define LS_RB0 KC_UNDS +#define LS_RB1 KC_PIPE +#define LS_RB2 KC_AMPR +#define LS_RB3 KC_CIRC +#define LS_RB4 KC_PERC +#define LS_RB5 KC_TRNS + +#define LS_LH5 KC_TRNS +#define LS_LH4 KC_TRNS +#define LS_LH3 KC_VOLD +#define LS_LH2 SK_DELWDL +#define LS_LH1 SK_DELWDR +#define LS_LH0 KC_VOLU +#define LS_LHA KC_VOLU +#define LS_RHA KC_NO +#define LS_RH0 KC_VOLU +#define LS_RH1 LALT(KC_9) // ª +#define LS_RH2 LSA(KC_8) // ° +#define LS_RH3 LSA(KC_9) // · +#define LS_RH4 KC_TRNS +#define LS_RH5 KC_TRNS + + +/* L_FUN LAYER K-key row (left) and Num row (right) + ╭──────────────────────────────────────────╮ ╭──────────────────────────────────────────╮ + RGB_TOG │ F9 F10 F11 F12 F13 │ │ / 7 8 9 - │ RGB_MOD + RGB_VAI │ C_T(F5) A_T(F6) G_T(F7) S_T(L8) F14 | | * S_T(1) G_T(2) A_T(3) C_T(+) │ RGB_HUI + RGB_VAD │ F1 F2 F3 F4 INS │ __ __ __ __ │ , 4 5 3 = │ RGB_HUD + ╰────────────────╮ __ __ __ │ __ __ │ 0 . TG(LN) ╭────────────────╯ + __ __ ╰─────────────────────────╯ ╰─────────────────────────╯ __ __ +*/ + +#define LF_LT5 RGB_TOG +#define LF_LT4 KC_F9 +#define LF_LT3 KC_F10 +#define LF_LT2 KC_F11 +#define LF_LT1 KC_F12 +#define LF_LT0 KC_F13 +#define LF_RT0 KC_SLSH +#define LF_RT1 KC_7 +#define LF_RT2 KC_8 +#define LF_RT3 KC_9 +#define LF_RT4 KC_MINS +#define LF_RT5 RGB_MOD + +#define LF_LM5 RGB_VAI +#define LF_LM4 LCTL_T(KC_F5) +#define LF_LM3 LALT_T(KC_F6) +#define LF_LM2 LGUI_T(KC_F7) +#define LF_LM1 KC_F8 +#define LF_LM0 KC_F14 +#define LF_RM0 KC_COMM +#define LF_RM1 KC_1 +#define LF_RM2 RGUI_T(KC_2) +#define LF_RM3 RALT_T(KC_3) +#define LF_RM4 RCTL_T(KC_PPLS) +#define LF_RM5 RGB_HUI + +#define LF_LB5 RGB_VAD +#define LF_LB4 KC_F1 +#define LF_LB3 KC_F2 +#define LF_LB2 KC_F3 +#define LF_LB1 KC_F4 +#define LF_LB0 KC_INS +#define LF_LBA KC_TRNS +#define LF_LBB KC_TRNS +#define LF_RBB KC_TRNS +#define LF_RBA KC_TRNS +#define LF_RB0 KC_COMM +#define LF_RB1 KC_4 +#define LF_RB2 KC_5 +#define LF_RB3 KC_6 +#define LF_RB4 KC_EQL +#define LF_RB5 RGB_HUD + +#define LF_LH5 KC_TRNS +#define LF_LH4 KC_TRNS +#define LF_LH3 KC_TRNS +#define LF_LH2 KC_SCLN +#define LF_LH1 KC_LSFT +#define LF_LH0 KC_TRNS +#define LF_LHA KC_NO +#define LF_RHA KC_NO +#define LF_RH0 KC_TRNS +#define LF_RH1 RSFT_T(KC_0) +#define LF_RH2 KC_DOT +#define LF_RH3 KC_TRNS +#define LF_RH4 SK_ZOOMRST +#define LF_RH5 KC_TRNS + + +/* L_NUM Navigation (left) NUMPad Layer (right) (LN) + ╭──────────────────────────────────────────╮ ╭──────────────────────────────────────────╮ +__ │ NUM_LK PGUP UP PGDN TAB │ │ PSLS P7 P8 P9 PMNS │ __ +__ │ W_LEFT LEFT DOWN RGHT W_RGHT | | PAST P4 P5 P6 PPLS │ __ +__ │ UNDO CUT COPY PSTE SPC │ __ __ __ __ │ PCMM P1 P2 P3 PEQL │ __ + ╰────────────────╮ __ G_T(BSP) S_T(ENT)│ __ __ │ P0 PDOT __ ╭────────────────╯ + __ __ ╰─────────────────────────╯ ╰─────────────────────────╯ __ __ +*/ + +#define LN_LT5 KC_TRNS +#define LN_LT4 KC_NUM +#define LN_LT3 KC_PGDN +#define LN_LT2 KC_UP +#define LN_LT1 KC_PGUP +#define LN_LT0 KC_TAB +#define LN_RT0 KC_PSLS +#define LN_RT1 KC_P7 +#define LN_RT2 KC_P8 +#define LN_RT3 KC_P9 +#define LN_RT4 KC_PMNS +#define LN_RT5 KC_TRNS + +#define LN_LM5 KC_TRNS +#define LN_LM4 SK_WORDPRV +#define LN_LM3 KC_LEFT +#define LN_LM2 KC_DOWN +#define LN_LM1 KC_RGHT +#define LN_LM0 SK_WORDNXT +#define LN_RM0 KC_PAST +#define LN_RM1 KC_P4 +#define LN_RM2 RGUI_T(KC_P5) +#define LN_RM3 RALT_T(KC_P6) +#define LN_RM4 RCTL_T(KC_PPLS) +#define LN_RM5 KC_TRNS + +#define LN_LB5 KC_TRNS +#define LN_LB4 SK_UNDO +#define LN_LB3 SK_CUT +#define LN_LB2 SK_COPY +#define LN_LB1 SK_PSTE +#define LN_LB0 KC_SPC +#define LN_LBA KC_ESC +#define LN_LBB KC_TRNS +#define LN_RBB KC_TRNS +#define LN_RBA KC_ESC +#define LN_RB0 KC_PCMM +#define LN_RB1 KC_P1 +#define LN_RB2 KC_P2 +#define LN_RB3 KC_P3 +#define LN_RB4 KC_PEQL +#define LN_RB5 KC_TRNS + +#define LN_LH5 KC_TRNS +#define LN_LH4 KC_TRNS +#define LN_LH3 KC_TRNS +#define LN_LH2 LGUI_T(KC_BSPC) +#define LN_LH1 LSFT_T(KC_ENT) +#define LN_LH0 KC_DEL +#define LN_LHA KC_NO +#define LN_RHA KC_NO +#define LN_RH0 KC_C +#define LN_RH1 KC_P0 +#define LN_RH2 KC_PDOT +#define LN_RH3 KC_TRNS +#define LN_RH4 KC_TRNS +#define LN_RH5 KC_TRNS + +/* L_NAV THE NAVIGATION (right hand) LAYER w/ edit & mods on left + ╭──────────────────────────────────────────╮ ╭───────────────────────────────────────────────╮ +__ │ QUIT CLOZ SCAP SCLP PSTM │ │ DOCBEG HOME UP PGUP PARAPRV │ KC_NUM +__ │ LCTL LALT LGUI LSFT FIND | | WORDPRV LEFT DOWN RGHT WORDNXT │ __ +__ │ UNDO CUT COPY PSTE FAGN │ __ __ __ __ │ DOCEND END DOWN PGDN PARANXT │ __ + ╰──────────────────╮ __ S(MENU) MENU │ __ __ │ HISTPRV HISTNXT __ ╭──────────────────╯ + HISTPRV HISTNXT ╰───────────────────────╯ ╰────────────────────────────╯ ZOOMRST ZOOMOUT +*/ + +#define LV_LT5 KC_TRNS +#define LV_LT4 SK_QUIT +#define LV_LT3 SK_CLOZ +#define LV_LT2 SK_SCAP +#define LV_LT1 SK_SCLP +#define LV_LT0 SK_PSTM +#define LV_RT0 SK_DOCBEG +#define LV_RT1 KC_HOME +#define LV_RT2 KC_UP +#define LV_RT3 KC_PGUP +#define LV_RT4 SK_PARAPRV +#define LV_RT5 KC_NUM + +#define LV_LM5 KC_VOLU +#define LV_LM4 KC_LCTL +#define LV_LM3 KC_LALT +#define LV_LM2 KC_LGUI +#define LV_LM1 KC_LSFT +#define LV_LM0 SK_FIND +#define LV_RM0 SK_WORDPRV +#define LV_RM1 KC_LEFT +#define LV_RM2 KC_DOWN +#define LV_RM3 KC_RGHT +#define LV_RM4 SK_WORDNXT +#define LV_RM5 KC_TRNS + +#define LV_LB5 KC_VOLD +#define LV_LB4 SK_UNDO +#define LV_LB3 SK_CUT +#define LV_LB2 SK_COPY +#define LV_LB1 SK_PSTE +#define LV_LB0 SK_FAGN +#define LV_LBA KC_TRNS +#define LV_LBB KC_TRNS +#define LV_RBB KC_TRNS +#define LV_RBA KC_TRNS +#define LV_RB0 SK_DOCEND +#define LV_RB1 KC_END +#define LV_RB2 KC_DOWN +#define LV_RB3 KC_PGDN +#define LV_RB4 SK_PARANXT +#define LV_RB5 KC_TRNS + +#define LV_LH5 KC_TRNS +#define LV_LH4 SK_ZOOMRST +#define LV_LH3 KC_TRNS +#define LV_LH2 KC_APP +#define LV_LH1 KC_LSFT // KC_APP +#define LV_LH0 KC_NO +#define LV_LHA KC_NO +#define LV_RHA KC_NO +#define LV_RH0 SK_ZOOMOUT +#define LV_RH1 SK_HISTPRV +#define LV_RH2 SK_HISTNXT +#define LV_RH3 SK_ZOOMIN +#define LV_RH4 SK_ZOOMRST +#define LV_RH5 KC_TRNS + +/* L_CFG Keyboard Configuration (left) and Media Settings (right) + __no__, QK_RBT, CG_SWAP, CG_NORM, EE_CLR, LCA(KC_DEL), SK_KILL, KC_NUM, KC_EJCT, __no__, SK_ZOOMRST, RGB_MOD, + RGB_VAI, HD_AdaptKeyToggle, HD_L_QWERTY, HD_L_ALPHA, KC_VOLU, KC_BRIU, __no__, KC_MPRV, KC_MUTE, KC_MNXT, SK_ZOOMOUT, RGB_SAI, + RGB_HUI, QK_BOOT, AG_SWAP, AG_NORM, KC_VOLD, KC_BRID, RGB_VAD, __no__, __no__, RGB_SAD, __no__, KC_MRWD, KC_MPLY, KC_MFFD, SK_ZOOMIN, RGB_HUD, + __no__, __no__, __no__, TG(L_NUM), __no__, __no__, __no__, __no__, __no__, __no__) +*/ + +#define LC_LT5 KC_NO +#define LC_LT4 QK_RBT +#define LC_LT3 CG_SWAP +#define LC_LT2 CG_NORM +#define LC_LT1 EE_CLR +#define LC_LT0 SK_KILL +#define LC_RT0 LCA(KC_DEL) +#define LC_RT1 KC_NUM +#define LC_RT2 KC_EJCT +#define LC_RT3 KC_NO +#define LC_RT4 SK_ZOOMRST +#define LC_RT5 RGB_MOD + +#define LC_LM5 RGB_VAI +#define LC_LM4 HD_AdaptKeyToggle +#define LC_LM3 HD_L_QWERTY +#define LC_LM2 HD_L_ALPHA +#define LC_LM1 KC_VOLU +#define LC_LM0 KC_BRIU +#define LC_RM0 KC_NO +#define LC_RM1 KC_MPRV +#define LC_RM2 KC_MUTE +#define LC_RM3 KC_MNXT +#define LC_RM4 SK_ZOOMOUT +#define LC_RM5 RGB_SAI + +#define LC_LB5 RGB_HUI +#define LC_LB4 QK_BOOT +#define LC_LB3 AG_SWAP +#define LC_LB2 AG_NORM +#define LC_LB1 KC_VOLD +#define LC_LB0 KC_BRID +#define LC_LBA RGB_VAD +#define LC_LBB KC_NO +#define LC_RBB KC_NO +#define LC_RBA RGB_SAD +#define LC_RB0 KC_NO +#define LC_RB1 KC_MRWD +#define LC_RB2 KC_MPLY +#define LC_RB3 KC_MFFD +#define LC_RB4 SK_ZOOMIN +#define LC_RB5 RGB_HUD + +#define LC_LH4 KC_NO +#define LC_LH3 KC_NO +#define LC_LH2 KC_NO +#define LC_LH1 TG(L_NUM) +#define LC_LH0 KC_NO +#define LC_LHA KC_NO +#define LC_RHA KC_NO +#define LC_RH0 KC_NO +#define LC_RH1 KC_NO +#define LC_RH2 KC_NO +#define LC_RH3 KC_NO +#define LC_RH4 KC_NO + diff --git a/moutis_matrix.c b/moutis_matrix.c index c84b463..34bcde5 100644 --- a/moutis_matrix.c +++ b/moutis_matrix.c @@ -9,104 +9,92 @@ void matrix_scan_user(void) { } #endif - if (state_reset_timer) { // is there an active state to check on (caps_word)? - - if (caps_word_on) { // caps_word mode on, (no mods) check if it needs to be cleared - if (timer_elapsed(state_reset_timer) > STATE_RESET_TIME * 3) {// caps time over? - disable_caps_word(); // turn off all open states - state_reset_timer = 0; - } + if (caps_word_timer) { // caps_word mode on?, check if it needs to be cleared + if (timer_elapsed(caps_word_timer) > STATE_RESET_TIME * 3) {// caps time over? + disable_caps_word(); // turn off all active states + return; } + } // // quick check in with the APP_MENU process -// This was inline, to avoid the call/return before the test in matrix, -// but doesn't seem to be an issue, even on AVR. // - matrix_APP_MENU(); - + if (appmenu_on) { // App menu up, (no mods) check if it needs to be cleared + if (timer_elapsed(appmenu_timer) > STATE_RESET_TIME) {// menu up time elapsed? + if (user_config.OSIndex) { // Y. stop the menu by lifting the mods + unregister_code(KC_RALT); // Win + } else { + unregister_code(KC_RGUI); // Mac + } + layer_off(L_NAV); + appmenu_on = false; + appmenu_timer = mods_held = 0; // stop the timer + return; + } + } + // // prior register_linger_key(kc) needs to be handled here // - if (linger_key && user_config.AdaptiveKeys) { // A linger key is being held down - if (timer_elapsed(linger_timer) > LINGER_TIME) { // linger triggered - saved_mods = get_mods(); - clear_mods(); - unregister_mods(MOD_MASK_SHIFT); // second char isn't shifted. CAPSLOCK UNAFFECTED. - switch(linger_key) { // only one linger_key at a time, obviously - case KC_Q: // already "Q" has been sent; if lingered, add "u" - tap_code(KC_U); - break; - - case KC_V: // already "V" has been sent; if lingered, add "ivi " - if ((saved_mods & MOD_MASK_SHIFT)) { - SEND_STRING("ivi"); - } - break; - case KC_Z: // already "Z" has been sent; if lingered, add "oe " - if ((saved_mods & MOD_MASK_SHIFT)) { - SEND_STRING("oe"); - } - break; - case KC_J: // already "Z" has been sent; if lingered, add "oe " - if ((saved_mods & MOD_MASK_SHIFT)) { - SEND_STRING("acob"); - } - break; + if (linger_key && user_config.AdaptiveKeys) { // A linger key is being held down + if (timer_elapsed(linger_timer) > LINGER_TIME) { // linger triggered + saved_mods = get_mods(); + clear_mods(); + unregister_mods(MOD_MASK_SHIFT); // second char isn't shifted. CAPSLOCK UNAFFECTED. + switch(linger_key) { + case KC_Q: // already "Q" has been sent; if lingered, add "u" + tap_code(KC_U); + break; - case KC_LPRN: // - tap_code16(KC_RPRN); - tap_code16(KC_LEFT); - break; - case KC_LBRC: // - tap_code16(KC_RBRC); - tap_code16(KC_LEFT); - break; - case KC_LCBR: // - tap_code16(KC_RCBR); - tap_code16(KC_LEFT); - break; - case KC_LT: // - tap_code16(KC_GT); - tap_code16(KC_LEFT); - break; + case KC_LPRN: // + tap_code16(KC_RPRN); + tap_code16(KC_LEFT); + break; + case KC_LBRC: // + tap_code16(KC_RBRC); + tap_code16(KC_LEFT); + break; + case KC_LCBR: // + tap_code16(KC_RCBR); + tap_code16(KC_LEFT); + break; + case KC_LT: // + tap_code16(KC_GT); + tap_code16(KC_LEFT); + break; - case KC_QUOT: // ‘|’ single paired quotes - tap_code16(KC_BSPC); - tap_SemKey(SK_SQUL); - tap_SemKey(SK_SQUR); - tap_code16(KC_LEFT); - break; - case KC_DQUO: // “|” double paired quotes - tap_code16(KC_BSPC); - clear_keyboard(); // QMK doesn't let go of shift here? - tap_SemKey(SK_SDQL); // “ - tap_SemKey(SK_SDQR); // ” - tap_code(KC_LEFT); - break; - case SK_FDQL: // « | » double French quote - tap_SemKey(SK_FDQR); - goto pushspaceshere; - case SK_FSQL: // ‹ | › single French quote - tap_SemKey(SK_FSQR); + case KC_QUOT: // ‘|’ single paired quotes + tap_code16(KC_BSPC); + tap_SemKey(SK_SQUL); + tap_SemKey(SK_SQUR); + tap_code16(KC_LEFT); + break; +// case SK_SDQU: // make “|” double paired quotes + case KC_DQUO: // + tap_code16(KC_BSPC); // get rid of prior straight dbl quote + clear_keyboard(); // QMK doesn't let go of shift here? + tap_SemKey(SK_SDQL); // “ + tap_SemKey(SK_SDQR); // ” + tap_code(KC_LEFT); + break; + case SK_FDQL: // « | » double French quote + tap_SemKey(SK_FDQR); + goto pushspaceshere; + case SK_FSQL: // ‹ | › single French quote + tap_SemKey(SK_FSQR); pushspaceshere: - tap_code(KC_LEFT); // break up 2 dble spc - tap_code16(KC_SPACE); // to thwart "smart" EOS. - tap_code(KC_LEFT); - tap_code16(KC_SPACE); - //unregister_SemKey(linger_key); - break; + tap_code(KC_LEFT); // break up 2 dble spc + tap_code16(KC_SPACE); // to thwart "smart" EOS. + tap_code(KC_LEFT); + tap_code16(KC_SPACE); + //unregister_SemKey(linger_key); + break; - default: - break; - } - linger_timer = state_reset_timer = 0; // stop lingering - set_mods(saved_mods); // Restore mods + default: + break; } + linger_timer = linger_key = 0; // done lingering + set_mods(saved_mods); // Restore mods } - } - - - } - +} diff --git a/moutis_process_record.c b/moutis_process_record.c index f82da9c..570f99d 100644 --- a/moutis_process_record.c +++ b/moutis_process_record.c @@ -18,11 +18,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed // keyup = not rolling = no adaptive -> return. && user_config.AdaptiveKeys // AdaptiveKeys is on #ifdef JP_MODE_ENABLE - && IS_ENGLISH_MODE + && IS_ENGLISH_MODE // Adaptives only in primary (Latin) mode #endif // #ifdef JP_MODE_ENABLE - ) { // Adaptives only in primary (Latin) mode - if (!process_adaptive_key(&keycode, record)) { + ) { + if (!process_adaptive_key(keycode, record)) { prior_keydown = timer_read(); // (re)start prior_key timing + preprior_keycode = prior_keycode; // look back 2 keystrokes? prior_keycode = keycode; // this keycode is stripped of mods+taps return false; // took care of that key } @@ -42,7 +43,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } // Do we turn off CAPS_WORD? - if (caps_word_on) { + if (caps_word_timer) { if (!process_caps_word(keycode, record)) { return false; // took care of that key } @@ -53,9 +54,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; // took care of that key } - // APP_MENU gets special treatment (also needs matrix_APP_MENU) + // APP_MENU gets special treatment (no adaptive handling, separate timers) -// if ((keycode & QK_BASIC_MAX) == KC_APP) { // mimic windows app key behavior (only better?) also in scan_matrix if (keycode == KC_APP) { // mimic windows app key behavior (only better?) also in scan_matrix process_APP_MENU(record); return false; // took care of that key @@ -67,6 +67,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { +// switch (((keycode >= SAFE_RANGE) && (keycode <= SemKeys_COUNT)) ? (keycode) : (keycode & QK_BASIC_MAX)) { // only handling normal, SHFT or ALT cases. switch (keycode) { // only handling normal, SHFT or ALT cases. /* @@ -79,14 +80,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { */ case KC_BSPC: // make S(KC_BSPC) = KC_DEL; ALT = word_del L & R - if (saved_mods & MOD_MASK_SHIFT) { // shift down with KC_BSPC? (ALT OK) - key_trap = KC_DEL; // mode monitor on to clear this on keyup -register_key_trap_and_return: - register_code16(key_trap); - return_state = false; // stop processing this record. - set_mods(saved_mods); // not sure if we need this - break; - } + if (!(saved_mods & MOD_MASK_SHIFT)) // only SHFT? (ALT ok) + break; // N: nothing to do + // shift down with KC_BSPC? (ALT OK) + unregister_mods(MOD_MASK_SA); // get rid of shift & alt + key_trap = KC_DEL; // mode monitor on to clear this on keyup + goto register_key_trap_and_return; +/* + key_trap = SK_DEL; // mode monitor on to clear this on keyup + register_semKey(key_trap); + return_state = false; // stop processing this record. + set_mods(saved_mods); // not sure if we need this + break; +*/ case KC_MINS: // SHIFT = + if (!(saved_mods & MOD_MASK_SHIFT)) // only SHFT? (ALT ok) break; // N: nothing to do @@ -96,8 +102,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_EQL: // SHIFT = _ if (!(saved_mods & MOD_MASK_SHIFT)) // only SHFT? (ALT ok) break; // N: nothing to do - key_trap = S(KC_MINS); // enter override state - goto register_key_trap_and_return; + key_trap = KC_UNDS; // enter override state +register_key_trap_and_return: + register_code16(key_trap); + return_state = false; // stop processing this record. + set_mods(saved_mods); // not sure if we need this + break; case KC_SLSH: // SHIFT = *, ALT=\, ALT+SHIFT=⁄ unregister_mods(MOD_MASK_SA); // get rid of shift & alt @@ -131,8 +141,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_LPRN: // SHIFT = { (linger=(|)) if (!saved_mods) { - register_linger_key(keycode); // example of simple linger macro - return_state = false; // don't do more with this record. + goto linger_and_return; // CAUTION: messing w/stack frame here!! } else if (saved_mods & MOD_MASK_SHIFT) { // shift down with KC_RPRN? if (saved_mods & MOD_MASK_ALT) { // SHIFT & ALT? register_linger_key(KC_LCBR); // this should be semkey for ‹/«? @@ -294,7 +303,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { register_linger_key(SQUO_S); // example of simple linger macro return_state = false; // don't do more with this record. } else //{ // no mods, so linger - goto byteshave; // CAUTION: messing w/stack frame here!! + register_linger_key(keycode); // example of simple linger macro + return_state = false; // don't do more with this record. break; case KC_QUOT: // SHIFT = ], ALT=», ALT+SHIFT=› @@ -315,37 +325,37 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { register_linger_key(DQUO_S); // example of simple linger macro return_state = false; // don't do more with this record. } else { // no mods, so -byteshave: // CAUTION: messing w/stack frame here!! register_linger_key(keycode); // example of simple linger macro return_state = false; // don't do more with this record. } break; #ifdef JP_MODE_ENABLE - case KC_L: // L if English, ん if Japanese mode - if (!IS_ENGLISH_MODE) { - tap_code(KC_N); - tap_code(KC_N); - return_state = false; // stop processing this record. - } - break; case KC_C: // C if English, z if Japanese mode if (!IS_ENGLISH_MODE) { register_code(KC_Z); return_state = false; // stop processing this record. } break; - case KC_X: // X if English, - if Japanese mode +#endif + case KC_L: // L if English, ん if Japanese mode + case KC_X: // X if English, - if Japanese mode +#ifdef JP_MODE_ENABLE if (!IS_ENGLISH_MODE) { - register_code(KC_MINS); - return_state = false; // stop processing this record. + switch (keycode) { + case KC_L: // L if English, ん if Japanese mode + tap_code(KC_N); + tap_code(KC_N); + return_state = false; // stop processing this record. + break; + case KC_X: // X if English, - if Japanese mode + register_code(KC_MINS); + return_state = false; // stop processing this record. + break; + } } - break; #endif - case KC_J: // optional linger - case KC_V: // optional linger case KC_Q: // Qu, linger deletes U - case KC_Z: // optional linger if ((saved_mods & MOD_MASK_ALT) #ifdef JP_MODE_ENABLE || !IS_ENGLISH_MODE @@ -358,29 +368,24 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { register_linger_key(keycode); // example of simple linger macro return_state = false; // stop processing this record. break; -/* - case KC_LNG1: // Japanese -#ifdef JP_MODE_ENABLE - IS_ENGLISH_MODE = false; -#endif - tap_SemKey(SK_HENK); // Mac/Win/iOS all different? + + case SK_Lux: // SINCE MAC IS MY LAYOUT DEFAULT switch to linux + user_config.OSIndex = OS_Lux; // for Linux Semkeys +// process_magic(QK_MAGIC_SWAP_CTL_GUI); // tell QMK to swap ctrl/gui + keymap_config.swap_lctl_lgui = keymap_config.swap_rctl_rgui = true; return_state = false; // stop processing this record. - break; - case KC_LNG2: // English -#ifdef JP_MODE_ENABLE - IS_ENGLISH_MODE = true; -#endif - tap_SemKey(SK_MHEN); // Mac/Win/iOS all different? + goto storeSettings; + case SK_Win: // SINCE MAC IS MY LAYOUT DEFAULT switch to windows + user_config.OSIndex = OS_Win; // for Windows Semkeys +// process_magic(QK_MAGIC_SWAP_CTL_GUI); // tell QMK to swap ctrl/gui + keymap_config.swap_lctl_lgui = keymap_config.swap_rctl_rgui = true; return_state = false; // stop processing this record. - break; -*/ - case CG_SWAP: // SINCE MAC IS MY LAYOUT DEFAULT switch to windows - user_config.OSIndex = 1; // for Windows Semkeys - return_state = true; // let QMK do it's swap thing. goto storeSettings; - case CG_NORM: // Back to default - user_config.OSIndex = 0; // for Mac Semkeys - return_state = true; // let QMK do it's swap thing. + case SK_Mac: // Back to default + user_config.OSIndex = OS_Mac; // for Mac Semkeys +// process_magic(QK_MAGIC_UNSWAP_CTL_GUI); // tell QMK to restore ctrl/gui + keymap_config.swap_lctl_lgui = keymap_config.swap_rctl_rgui = false; + return_state = false; // stop processing this record. goto storeSettings; case HD_AdaptKeyToggle: // toggle AdaptiveKeys (& LingerKeys, linger combos) #ifdef ADAPTIVE_ENABLE @@ -405,10 +410,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; #endif // KEY_OVERRIDE_ENABLE + + +#ifdef RGBLIGHT_ENABLE + case HD_RGB_sat_up: // Sat + + rgblight_increase_sat(); // Sat + + break; + case HD_RGB_sat_dn: // Sat - + rgblight_decrease_sat(); // Sat - + break; + case HD_RGB_hue_up: // Hue + + rgblight_increase_hue(); // Hue + + break; + case HD_RGB_hue_dn: // Hue + + rgblight_decrease_hue(); // Hue - + break; +#endif + } // switch (keycode) { #ifdef ADAPTIVE_ENABLE prior_keydown = timer_read(); // (re)start prior_key timing + preprior_keycode = prior_keycode; // look back 2 keystrokes? prior_keycode = keycode; // this keycode is now stripped of mods+taps #endif @@ -425,16 +448,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return_state = false; // stop processing this record. } break; - case KC_X: // X if English, - if Japanese mode + + case KC_X: // X if English, - if Japanese mode if (!IS_ENGLISH_MODE) { unregister_code(KC_MINS); return_state = false; // stop processing this record. } break; #endif - case KC_J: // - case KC_V: // - case KC_Z: // + case KC_Q: // for linger Qu (ironically, need to handle this direclty w/o the macros.) unregister_code16(keycode); linger_key = 0; // make sure nothing lingers @@ -470,6 +492,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case KC_BSPC: // make S(KC_BSPC) = KC_DEL; plus word_del L & R +/* + if (!key_trap) // did we override this earlier? + break; // N: do normal thing + unregister_SemKey(key_trap); // + key_trap = 0; // exit override state. + return_state = false; // stop processing this record. + break; +*/ case KC_MINS: // SHIFT = +, ALT=–(n-dash), ALT+SHIFT=± case KC_EQL: // ALT _ case KC_SLSH: // SHIFT = *, ALT=\, ALT+SHIFT=⁄ diff --git a/moutis_semantickeys.c b/moutis_semantickeys.c index 7082e10..579ad59 100644 --- a/moutis_semantickeys.c +++ b/moutis_semantickeys.c @@ -65,67 +65,69 @@ void tap_SemKey(uint16_t semkeycode) { const uint16_t SemKeys_t[SemKeys_COUNT - SK_KILL][OS_count] = { // Mac, Win, (Phase 3, add others if necessary, expand to multi-key?) [SK_KILL - SK_KILL] = {G(A(KC_ESC)),C(A(KC_DEL))}, // Force quit / ctrl-alt-del - [SK_HENK - SK_KILL] = {KC_LNG1, C(S(KC_1))}, // 変換/かな - [SK_MHEN - SK_KILL] = {KC_LNG2, C(S(KC_0))}, // 無変換/英数 - [SK_HENT - SK_KILL] = {G(KC_ENT),C(KC_ENT)}, // Hard ENTER - [SK_UNDO - SK_KILL] = {G(KC_Z),C(KC_Z)}, // undo - [SK_REDO - SK_KILL] = {G(S(KC_Z)),C(S(KC_Z))}, // Redo - [SK_CUT - SK_KILL] = {G(KC_X),C(KC_X)}, // cut - [SK_COPY - SK_KILL] = {G(KC_C),C(KC_C)}, // copy - [SK_PSTE - SK_KILL] = {G(KC_V),C(KC_V)}, // paste - [SK_PSTM - SK_KILL] = {G(S(A(KC_V))),C(S(A(KC_V)))}, // paste_match - [SK_SALL - SK_KILL] = {G(KC_A),C(KC_A)}, // select all - [SK_CLOZ - SK_KILL] = {G(KC_W),C(KC_W)}, // close - [SK_QUIT - SK_KILL] = {G(KC_Q),C(KC_Q)}, // quit - [SK_NEW - SK_KILL] = {G(KC_N),C(KC_N)}, // new - [SK_OPEN - SK_KILL] = {G(KC_O),C(KC_O)}, // open - [SK_FIND - SK_KILL] = {G(KC_F),C(KC_F)}, // find - [SK_FAGN - SK_KILL] = {G(KC_G),KC_F3}, // find again - [SK_SCAP - SK_KILL] = {S(G(KC_4)),KC_PSCR}, // Screen Capture - [SK_SCLP - SK_KILL] = {C(S(G(KC_4))),A(KC_PSCR)}, // Selection Capture)) - [SK_DELWDL - SK_KILL] = {A(KC_BSPC),C(KC_BSPC)}, // DELETE WORD LEFT - [SK_DELWDR - SK_KILL] = {A(KC_DEL),C(KC_DEL)}, // DELETE WORD RIGHT - [SK_WORDPRV - SK_KILL] = {A(KC_LEFT),C(KC_LEFT)}, // WORD LEFT - [SK_WORDNXT - SK_KILL] = {A(KC_RIGHT),C(KC_RIGHT)}, // WORD RIGHT - [SK_DOCBEG - SK_KILL] = {G(KC_UP),C(KC_HOME)}, // Go to start of document - [SK_DOCEND - SK_KILL] = {G(KC_DOWN),C(KC_END)}, // Go to end of document - [SK_LINEBEG - SK_KILL] = {G(KC_DOWN),C(KC_END)}, // Go to beg of line - [SK_LINEEND - SK_KILL] = {G(KC_DOWN),C(KC_END)}, // Go to end of line - [SK_PARAPRV - SK_KILL] = {A(KC_UP),C(KC_UP)}, // Go to previous paragraph - [SK_PARANXT - SK_KILL] = {A(KC_DOWN),C(KC_DOWN)}, // Go to next paragraph - [SK_HISTPRV - SK_KILL] = {G(KC_LBRC),A(KC_LEFT)}, // BROWSER BACK - [SK_HISTNXT - SK_KILL] = {G(KC_RBRC),A(KC_RIGHT)}, // BROWSER FWD - [SK_ZOOMIN - SK_KILL] = {G(KC_EQL),C(KC_EQL)}, // ZOOM IN - [SK_ZOOMOUT - SK_KILL] = {G(KC_MINS),C(KC_MINS)}, // ZOOM OUT - [SK_ZOOMRST - SK_KILL] = {G(KC_0),C(KC_0)}, // ZOOM RESET - [SK_APPNXT - SK_KILL] = {RGUI(KC_TAB),A(KC_TAB)}, // APP switcher Next (last used) - [SK_APPPRV - SK_KILL] = {RGUI(RSFT(KC_TAB)),A(S(KC_TAB))}, // APP switcher Prev (least recently used) - [SK_WINNXT - SK_KILL] = {RCTL(KC_TAB),C(KC_TAB)}, // Window/tab switcher Next - [SK_WINPRV - SK_KILL] = {RCTL(RSFT(KC_TAB)),C(S(KC_TAB))}, // Window/tab switcher Prev + [SK_HENK - SK_KILL] = {KC_LNG1, C(S(KC_1)), C(S(KC_1))}, // 変換/かな + [SK_MHEN - SK_KILL] = {KC_LNG2, C(S(KC_0)), C(S(KC_0))}, // 無変換/英数 + [SK_HENT - SK_KILL] = {G(KC_ENT),C(KC_ENT),C(KC_ENT)}, // Hard ENTER + [SK_UNDO - SK_KILL] = {G(KC_Z),C(KC_Z),C(KC_Z)}, // undo + [SK_REDO - SK_KILL] = {G(S(KC_Z)),C(S(KC_Z)),C(S(KC_Z))}, // Redo + [SK_CUT - SK_KILL] = {G(KC_X),C(KC_X),C(KC_X)}, // cut + [SK_COPY - SK_KILL] = {G(KC_C),C(KC_C),C(KC_C)}, // copy + [SK_PSTE - SK_KILL] = {G(KC_V),C(KC_V),C(KC_V)}, // paste + [SK_PSTM - SK_KILL] = {G(S(A(KC_V))),C(S(A(KC_V))),C(S(A(KC_V)))}, // paste_match + [SK_SALL - SK_KILL] = {G(KC_A),C(KC_A),C(KC_A)}, // select all + [SK_CLOZ - SK_KILL] = {G(KC_W),C(KC_W),C(KC_W)}, // close + [SK_QUIT - SK_KILL] = {G(KC_Q),C(KC_Q),C(KC_Q)}, // quit + [SK_NEW - SK_KILL] = {G(KC_N),C(KC_N),C(KC_N)}, // new + [SK_OPEN - SK_KILL] = {G(KC_O),C(KC_O),C(KC_O)}, // open + [SK_FIND - SK_KILL] = {G(KC_F),C(KC_F),C(KC_F)}, // find + [SK_FAGN - SK_KILL] = {G(KC_G),KC_F3,KC_F3}, // find again + [SK_SCAP - SK_KILL] = {S(G(KC_4)),KC_PSCR,KC_PSCR}, // Screen Capture + [SK_SCLP - SK_KILL] = {C(S(G(KC_4))),A(KC_PSCR),A(KC_PSCR)}, // Selection Capture)) +// [SK_DEL - SK_KILL] = {KC_DEL,KC_DEL,KC_DEL}, // DELETE CHAR RIGHT + [SK_DELWDL - SK_KILL] = {A(KC_BSPC),C(KC_BSPC),C(KC_BSPC)}, // DELETE WORD LEFT + [SK_DELWDR - SK_KILL] = {A(KC_DEL),C(KC_DEL),C(KC_DEL)}, // DELETE WORD RIGHT + [SK_WORDPRV - SK_KILL] = {A(KC_LEFT),C(KC_LEFT),C(KC_LEFT)}, // WORD LEFT + [SK_WORDNXT - SK_KILL] = {A(KC_RIGHT),C(KC_RIGHT),C(KC_RIGHT)}, // WORD RIGHT + [SK_DOCBEG - SK_KILL] = {G(KC_UP),C(KC_HOME),C(KC_HOME)}, // Go to start of document + [SK_DOCEND - SK_KILL] = {G(KC_DOWN),C(KC_END),C(KC_END)}, // Go to end of document + [SK_LINEBEG - SK_KILL] = {G(KC_DOWN),C(KC_END),C(KC_END)}, // Go to beg of line + [SK_LINEEND - SK_KILL] = {G(KC_DOWN),C(KC_END),C(KC_END)}, // Go to end of line + [SK_PARAPRV - SK_KILL] = {A(KC_UP),C(KC_UP),C(KC_UP)}, // Go to previous paragraph + [SK_PARANXT - SK_KILL] = {A(KC_DOWN),C(KC_DOWN),C(KC_DOWN)}, // Go to next paragraph + [SK_HISTPRV - SK_KILL] = {G(KC_LBRC),A(KC_LEFT),A(KC_LEFT)}, // BROWSER BACK + [SK_HISTNXT - SK_KILL] = {G(KC_RBRC),A(KC_RIGHT),A(KC_RIGHT)}, // BROWSER FWD + [SK_ZOOMIN - SK_KILL] = {G(KC_EQL),C(KC_EQL),C(KC_EQL)}, // ZOOM IN + [SK_ZOOMOUT - SK_KILL] = {G(KC_MINS),C(KC_MINS),C(KC_MINS)}, // ZOOM OUT + [SK_ZOOMRST - SK_KILL] = {G(KC_0),C(KC_0),C(KC_0)}, // ZOOM RESET + [SK_APPNXT - SK_KILL] = {RGUI(KC_TAB),A(KC_TAB),A(KC_TAB)}, // APP switcher Next (last used) + [SK_APPPRV - SK_KILL] = {RGUI(RSFT(KC_TAB)),A(S(KC_TAB)),A(S(KC_TAB))}, // APP switcher Prev (least recently used) + [SK_WINNXT - SK_KILL] = {RCTL(KC_TAB),C(KC_TAB),C(KC_TAB)}, // Window/tab switcher Next + [SK_WINPRV - SK_KILL] = {RCTL(RSFT(KC_TAB)),C(S(KC_TAB)),C(S(KC_TAB))}, // Window/tab switcher Prev // Punctuation - [SK_SECT - SK_KILL] = {A(KC_5),0xE167}, // § ** need Win Compose via BCD. - [SK_ENYE - SK_KILL] = {A(KC_N),A(KC_N)}, // ñ/Ñ ** need Win Compose via BCD? - [SK_IEXC - SK_KILL] = {RALT(KC_1),RALT(KC_1)}, // ¡ Inverted exclamation mark ** need Win Compose via BCD? - [SK_ELPS - SK_KILL] = {A(KC_SCLN),A(KC_SCLN)}, // … ** need Win Compose via BCD? - [SK_PARA - SK_KILL] = {A(KC_7),A(KC_7)}, // ¶ ** need Win Compose via BCD? - [SK_MDSH - SK_KILL] = {S(A(KC_MINS)),S(A(KC_MINS))}, // — ** need Win Compose via BCD? - [SK_DCRS - SK_KILL] = {LSA(KC_7),LSA(KC_7)}, // ‡ Double Cross ** need Win Compose via BCD? - [SK_SCRS - SK_KILL] = {RSA(KC_5),RSA(KC_5)}, // † Single Cross ** need Win Compose via BCD? - [SK_BBLT - SK_KILL] = {LALT(KC_8),LALT(KC_8)}, // • Bold Bullet ** need Win Compose via BCD? + [SK_SECT - SK_KILL] = {A(KC_5),0xE167,0xE167}, // § ** need Win Compose via BCD. + [SK_ENYE - SK_KILL] = {A(KC_N),A(KC_N),A(KC_N)}, // ñ/Ñ ** need Win Compose via BCD? + [SK_IEXC - SK_KILL] = {RALT(KC_1),RALT(KC_1),RALT(KC_1)}, // ¡ Inverted exclamation mark ** need Win Compose via BCD? + [SK_ELPS - SK_KILL] = {A(KC_SCLN),A(KC_SCLN),A(KC_SCLN)}, // … ** need Win Compose via BCD? + [SK_PARA - SK_KILL] = {A(KC_7),A(KC_7),A(KC_7)}, // ¶ ** need Win Compose via BCD? + [SK_MDSH - SK_KILL] = {S(A(KC_MINS)),S(A(KC_MINS)),S(A(KC_MINS))}, // — ** need Win Compose via BCD? + [SK_DCRS - SK_KILL] = {LSA(KC_7),LSA(KC_7),LSA(KC_7)}, // ‡ Double Cross ** need Win Compose via BCD? + [SK_SCRS - SK_KILL] = {RSA(KC_5),RSA(KC_5),RSA(KC_5)}, // † Single Cross ** need Win Compose via BCD? + [SK_BBLT - SK_KILL] = {LALT(KC_8),LALT(KC_8),LALT(KC_8)}, // • Bold Bullet ** need Win Compose via BCD? // Currency - [SK_CENT - SK_KILL] = {LALT(KC_4),LALT(KC_4)}, // ¢ ** need Win Compose via BCD? - [SK_EURO - SK_KILL] = {A(S(KC_2)),A(S(KC_2))}, // € ** need Win Compose via BCD? - [SK_BPND - SK_KILL] = {RALT(KC_3),RALT(KC_3)}, // £ ** need Win Compose via BCD? - [SK_JPY - SK_KILL] = {LALT(KC_Y),LALT(KC_Y)}, // ¥ ** need Win Compose via BCD? + [SK_CENT - SK_KILL] = {LALT(KC_4),LALT(KC_4),LALT(KC_4)}, // ¢ ** need Win Compose via BCD? + [SK_EURO - SK_KILL] = {A(S(KC_2)),A(S(KC_2)),A(S(KC_2))}, // € ** need Win Compose via BCD? + [SK_BPND - SK_KILL] = {RALT(KC_3),RALT(KC_3),RALT(KC_3)}, // £ ** need Win Compose via BCD? + [SK_JPY - SK_KILL] = {LALT(KC_Y),LALT(KC_Y),LALT(KC_Y)}, // ¥ ** need Win Compose via BCD? // Quotations - [SK_SQUL - SK_KILL] = {A(KC_RBRC),A(KC_RBRC)}, // ’ ** Left single quote UNICODE? - [SK_SQUR - SK_KILL] = {S(A(KC_RBRC)),S(A(KC_RBRC))}, // ’ ** Right single quote UNICODE? - [SK_SDQL - SK_KILL] = {A(KC_LBRC),A(KC_LBRC)}, // “ ** Left double quote UNICODE? - [SK_SDQR - SK_KILL] = {A(S(KC_LBRC)),A(S(KC_LBRC))}, // ” ** Right double quote UNICODE? - [SK_FDQL - SK_KILL] = {A(KC_BSLS),A(KC_BSLS)}, // « Left double French quote UNICODE? - [SK_FDQR - SK_KILL] = {S(A(KC_BSLS)),S(A(KC_BSLS))}, // » Right double French quote UNICODE? - [SK_FSQL - SK_KILL] = {S(A(KC_3)),A(KC_LBRC)}, // ‹ Left single French quote UNICODE? - [SK_FSQR - SK_KILL] = {S(A(KC_4)),A(S(KC_LBRC))}, // › Right single French quote UNICODE? + [SK_SQUL - SK_KILL] = {A(KC_RBRC),A(KC_RBRC),A(KC_RBRC)}, // ’ ** Left single quote UNICODE? + [SK_SQUR - SK_KILL] = {S(A(KC_RBRC)),S(A(KC_RBRC)),S(A(KC_RBRC))}, // ’ ** Right single quote UNICODE? +// [SK_SDQU - SK_KILL] = {KC_DQUO,KC_DQUO,KC_DQUO}, // " straight double-quote character + [SK_SDQL - SK_KILL] = {A(KC_LBRC),A(KC_LBRC),A(KC_LBRC)}, // “ ** Left double quote UNICODE? + [SK_SDQR - SK_KILL] = {A(S(KC_LBRC)),A(S(KC_LBRC)),A(S(KC_LBRC))}, // ” ** Right double quote UNICODE? + [SK_FDQL - SK_KILL] = {A(KC_BSLS),A(KC_BSLS),A(KC_BSLS)}, // « Left double French quote UNICODE? + [SK_FDQR - SK_KILL] = {S(A(KC_BSLS)),S(A(KC_BSLS)),S(A(KC_BSLS))}, // » Right double French quote UNICODE? + [SK_FSQL - SK_KILL] = {S(A(KC_3)),A(KC_LBRC),A(KC_LBRC)}, // ‹ Left single French quote UNICODE? + [SK_FSQR - SK_KILL] = {S(A(KC_4)),A(S(KC_LBRC)),A(S(KC_LBRC))}, // › Right single French quote UNICODE? }; diff --git a/moutis_semantickeys.h b/moutis_semantickeys.h index 654ded2..988cb32 100644 --- a/moutis_semantickeys.h +++ b/moutis_semantickeys.h @@ -29,7 +29,16 @@ enum my_keycodes { HD_AdaptKeyToggle = SAFE_RANGE, // Adaptive Keys Toggle on/off HD_L_QWERTY, // base layer switch HD_L_ALPHA, - // Semantic Keys (keystrokes handled by process_semkey() for platform independence) +#ifdef RGBLIGHT_ENABLE // backlight/underglow + HD_RGB_sat_up, // Sat + + HD_RGB_sat_dn, // Sat - + HD_RGB_hue_up, // Hue + + HD_RGB_hue_dn, // Hue + +#endif + SK_Mac, + SK_Win, + SK_Lux, + // Semantic Keys (keystrokes handled by process_semkey() for platform independence) SK_KILL, // SK_KILL must be the first of contiguous block of SKs SK_HENK, // kana (others) SK_MHEN, // eisuu (others) @@ -50,6 +59,7 @@ enum my_keycodes { SK_FAGN, // find again SK_SCAP, // screen capture to clipboard SK_SCLP, // selection capture to clipboard +// SK_DEL, // Delete char right of cursor SK_DELWDL, // Delete word left of cursor SK_DELWDR, // Delete word right of cursor @@ -88,6 +98,7 @@ enum my_keycodes { // Quotations SK_SQUL, // ’ Left single quote (linger for paired) SK_SQUR, // ’ Right single quote +// SK_SDQU, // " straight double-quote character (custom so we can manipulate it.) SK_SDQL, // ’ Left double quote (linger for paired) SK_SDQR, // ’ Right double quote SK_FDQL, // ’ « Left double French quote (linger for paired) @@ -132,9 +143,15 @@ enum my_keycodes { #define L_BASELAYER HD_L_QWERTY +#define first_SemKey SK_KILL +#define last_Semkey SemKeys_COUNT + +#define is_SemKey(sk) ((sk > (uint16_t)first_SemKey) && (sk < (uint16_t)last_Semkey)) + #define tap_SemKey(sk) tap_code16(SemKeys_t[sk - SK_KILL][user_config.OSIndex]) #define register_SemKey(sk) register_code16(SemKeys_t[sk - SK_KILL][user_config.OSIndex]) #define unregister_SemKey(sk) unregister_code16(SemKeys_t[sk - SK_KILL][user_config.OSIndex]) #define linger_SemKey(sk) {register_code16(SemKeys_t[sk - SK_KILL][user_config.OSIndex]);linger_key = sk;linger_timer = state_reset_timer = timer_read();} #define unlinger_SemKey(sk) {unregister_code16(SemKeys_t[linger_key - SK_KILL][user_config.OSIndex]);linger_key = 0;} + diff --git a/personalizedmacros.h b/personalizedmacros.h new file mode 100644 index 0000000..7849937 --- /dev/null +++ b/personalizedmacros.h @@ -0,0 +1,28 @@ +// +// personalizedmacros.h +// +// + +#define At_ComboHeld "alanreiser.com" + +#define LeftComboTapE "English " +#define LeftComboHeldE "End of times in 2020" +#define LeftComboTapJ "arigatou" +#define LeftComboHeldJ "yorosiku" +#define RightComboTapE "Japan " +#define RightComboHeldE "Japanese " +#define RightComboTapJ "gozaimasu." +#define RightComboHeldJ "onegaisimasu." + +#define adaptAHASH "Amanda " +#define adaptBHASH "Bug " +#define adaptGHASH "Gratefully, " +#define adaptEHASH "Eric " +#define adaptJHASH "Jacob" +#define adaptLHASH "Lauren " +#define adaptMHASH "mym0vies" +#define adaptRHASH "Reiser " +#define adaptTHASH "Tahlia " +#define adaptVHASH "Vivian " +#define adaptXHASH "pianobylauren@gmail.com" +#define adaptZHASH "Zoe"