diff --git a/keyboards/crkbd/keymaps/sajenim/autocorrect_dictionary.txt b/keyboards/crkbd/keymaps/sajenim/autocorrect_dictionary.txt new file mode 100644 index 0000000..11d1543 --- /dev/null +++ b/keyboards/crkbd/keymaps/sajenim/autocorrect_dictionary.txt @@ -0,0 +1,474 @@ + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# This is a larger example typo dictionary containing 400 entries. It builds to +# a table of about 6000 bytes, so you'll need a keyboard with a generous +# amount of free firmware space to use the full dictionary. Alternatively, pick +# out a subset of entries to a separate file, then build a table from that. +# +# Dictionary syntax: +# Each line of this file defines one typo correction entry with the syntax +# "typo -> correction". Typos and corrections are case insensitive, and any +# whitespace before or after the typo and correction is ignored. The typo must be +# only the letters a-z, or the special character : representing a word break. +# +# For documentation about how to use this dictionary, see +# https://getreuer.info/posts/keyboards/autocorrection +# +# Further resources: +# * Wikipedia has a large list of common typos at +# https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines +# +# * EmacsWiki has another list of typos at +# https://www.emacswiki.org/emacs/autocorrection_abbrev_defs +# +# * You can find data on English word frequencies at +# https://www.wordfrequency.info/samples.asp + + +## 10 most common words. +# The words "there", "about", "their", "would", "people", "which", "could", +# "think", "other", and "because" are among the most common words in English +# that are 5 letters or longer. (We don't include entries for words shorter than +# that to avoid false triggering.) +:htere -> there +abbout -> about +abotu -> about +baout -> about +:theri -> their +:thier -> their +:owudl -> would +woudl -> would +peaple -> people +peolpe -> people +peopel -> people +poeple -> people +poeople -> people +:hwihc -> which +whcih -> which +whihc -> which +whlch -> which +wihch -> which +coudl -> could +:htikn -> think +:htink -> think +thikn -> think +thiunk -> think +tihkn -> think +:olther -> other +:otehr -> other +baceause -> because +beacuse -> because +becasue -> because +beccause -> because +becouse -> because +becuase -> because + +## Common words, 11-20. +theese -> these +:goign -> going +:gonig -> going +:yaers -> years +:yeasr -> years +:thsoe -> those +shoudl -> should +raelly -> really +realy -> really +relaly -> really +bedore -> before +befoer -> before +littel -> little +beeing -> being +:hwile -> while + +## Common words, 21-30. +aroud -> around +arround -> around +arund -> around +thign -> thing +thigsn -> things +thnigs -> things +anohter -> another +beteen -> between +beween -> between +bewteen -> between +:eveyr -> every +:graet -> great +:agian -> again +:sicne -> since +alwasy -> always +alwyas -> always +throught -> thought + + +## Words especially susceptible to skipping or transposing a letter. +# These entries are for words that are easy enough to spell, but not necessarily +# easy to press the keys in the right order. +# Catch misspellings of "achieves", "achieving", etc. +:acheiv -> achiev +almsot -> almost +alomst -> almost +chnage -> change +chekc -> check +childen -> children +claer -> clear +comapny -> company +contian -> contain +elasped -> elapsed +feild -> field +fitler -> filter +firts -> first +follwo -> follow +:foudn -> found +frequecy -> frequency +firend -> friend +freind -> friend +heigth -> height +iamge -> image +inital -> initial +intput -> input +laguage -> language +lenght -> length +levle -> level +libary -> library +:moeny -> money +mysefl -> myself +ouptut -> output +ouput -> output +probaly -> probably +probelm -> problem +recrod -> record +reponse -> response +reprot -> report +singel -> single +stregth -> strength +strengh -> strength +tkaes -> takes +therfore -> therefore +todya -> today +toghether -> together +unkown -> unknown +unqiue -> unique +widht -> width + + +## Words with tricky spelling. +# If you are a good speller, you could drop this section. +aberation -> aberration +accross -> across +adviced -> advised +aledge -> allege +alledge -> allege +amature -> amateur +anomolous -> anomalous +anomoly -> anomaly +aparent -> apparent +aparrent -> apparent +apparant -> apparent +apparrent -> apparent +asthetic -> aesthetic +auxilary -> auxiliary +auxillary -> auxiliary +auxilliary -> auxiliary +bankrupcy -> bankruptcy +busness -> business +bussiness -> business +calander -> calendar +commitee -> committee +comittee -> committee +competance -> competence +competant -> competent +concensus -> consensus +cognizent -> cognizant +copywrite: -> copyright +choosen -> chosen +collegue -> colleague +excercise -> exercise +:grammer -> grammar +:guage -> gauge +govement -> government +govenment -> government +goverment -> government +governmnet -> government +govorment -> government +govornment -> government +guaratee -> guarantee +garantee -> guarantee +gaurantee -> guarantee +heirarchy -> hierarchy +hygeine -> hygiene +hypocracy -> hypocrisy +hypocrasy -> hypocrisy +hypocricy -> hypocrisy +hypocrit: -> hypocrite +looses: -> loses +maintence -> maintenance +morgage -> mortgage +neccesary -> necessary +necesary -> necessary +pallete -> palette +paralel -> parallel +parralel -> parallel +parrallel -> parallel +priviledge -> privilege +probablly -> probably +prominant -> prominent +propogate -> propagate +proove -> prove +psuedo -> pseudo +reciept -> receipt +# Catch misspellings of "receives", "receiving", etc. +receiev -> receiv +reciev -> receiv +recepient -> recipient +recipiant -> recipient +relevent -> relevant +repitition -> repetition +safty -> safety +saftey -> safety +# Catch misspellings of "separate", "separating", etc. +seperat -> separat +spectogram -> spectrogram +symetric -> symmetric +tolerence -> tolerance + + +## Words particularly for coding. +# Entries for common code keywords ("const") and terminology ("lookup"). +cacheing -> caching +complier -> compiler +doulbe -> double +dyanmic -> dynamic +# As in "execute", "executable", "executing", ... +excecut -> execut +failse -> false +fales -> false +fasle -> false +flase -> false +indeces -> indices +indecies -> indices +indicies -> indices +interator -> iterator +looup -> lookup +namesapce -> namespace +namespcae -> namespace +nulltpr -> nullptr +operaotr -> operator +overide -> override +ovveride -> override +poitner -> pointer +:rference -> reference +referece -> reference +singed -> signed +stirng -> string +strign -> string +swithc -> switch +swtich -> switch +teamplate -> template +tempalte -> template +:ture -> true +retrun -> return +retun -> return +reutrn -> return +cosnt -> const +virutal -> virtual +vitual -> virtual +yeild -> yield + + +## Catch skipped spaces between common words. +:alot: -> a lot +:andteh -> and the +:andthe -> and the +:asthe -> as the +:atthe -> at the +abouta -> about a +aboutit -> about it +aboutthe -> about the +:tothe -> to the +didnot -> did not +fromthe -> from the + + +## Various additional entries. +:agred -> agreed +:ajust -> adjust +:anual -> annual +:asign -> assign +:aslo: -> also +:casue -> cause +:choses -> chooses +:gaurd -> guard +:haev -> have +:hapen -> happen +:idaes -> ideas +:jsut: -> just +:jstu: -> just +:knwo -> know +:konw -> know +:kwno -> know +:ocuntry -> country +:ocur -> occur +:socre -> score +:szie -> size +:the:the: -> the +:turth -> truth +:uesd: -> used +:usally -> usually +abilties -> abilities +abilty -> ability +abvove -> above +accesories -> accessories +accomodate -> accommodate +acommodate -> accommodate +acomplish -> accomplish +actualy -> actually +acurate -> accurate +acutally -> actually +addtion -> addition +againnst -> against +aganist -> against +aggreed -> agreed +agianst -> against +ahppn -> happen +allign -> align +anytying -> anything +aquire -> acquire +availabe -> available +availaible -> available +availalbe -> available +availble -> available +availiable -> available +avalable -> available +avaliable -> available +avilable -> available +bandwith -> bandwidth +begginer -> beginner +beleif -> belief +beleive -> believe +belive -> believe +breif -> brief +burried -> buried +caluclate -> calculate +caluculate -> calculate +calulate -> calculate +catagory -> category +cauhgt -> caught +ceratin -> certain +certian -> certain +cheif -> chief +cieling -> ceiling +circut -> circuit +clasic -> classic +cmoputer -> computer +coform -> conform +comming: -> coming +considerd -> considered +dervied -> derived +desicion -> decision +diferent -> different +diferrent -> different +differnt -> different +diffrent -> different +divison -> division +effecient -> efficient +eligable -> eligible +elpased -> elapsed +embarass -> embarrass +embeded -> embedded +encypt -> encrypt +finaly -> finally +foriegn -> foreign +foward -> forward +fraciton -> fraction +fucntion -> function +fufill -> fulfill +fullfill -> fulfill +futher -> further +ganerate -> generate +generaly -> generally +greatful -> grateful +heigher -> higher +higest -> highest +howver -> however +hydogen -> hydrogen +importamt -> important +inclued -> include +insted -> instead +intrest -> interest +invliad -> invalid +largst -> largest +learnign -> learning +liasion -> liaison +likly -> likely +lisense -> license +listner -> listener +macthing -> matching +manefist -> manifest +mesage -> message +naturual -> natural +occassion -> occasion +occured -> occurred +particualr -> particular +paticular -> particular +peice -> piece +perhasp -> perhaps +perheaps -> perhaps +perhpas -> perhaps +perphas -> perhaps +persue -> pursue +posess -> possess +postion -> position +preiod -> period +primarly -> primarily +privte -> private +proccess -> process +proeprty -> property +propery -> property +realtion -> relation +reasearch -> research +recuring -> recurring +refered -> referred +regluar -> regular +releated -> related +resutl -> result +reuslt -> result +reveiw -> review +satisifed -> satisfied +scheduel -> schedule +sequnce -> sequence +similiar -> similar +simmilar -> similar +slighly -> slightly +somehwat -> somewhat +statment -> statement +sucess -> success +succsess -> success +sugest -> suggest +sumary -> summary +supress -> suppress +surpress -> suppress +thresold -> threshold +tongiht -> tonight +tranpose -> transpose +typcial -> typical +udpate -> update +ususally -> usually +verticies -> vertices +whereever -> wherever +wherre -> where +wierd -> weird + diff --git a/keyboards/crkbd/keymaps/sajenim/config.h b/keyboards/crkbd/keymaps/sajenim/config.h index 41d1374..77ac164 100644 --- a/keyboards/crkbd/keymaps/sajenim/config.h +++ b/keyboards/crkbd/keymaps/sajenim/config.h @@ -7,6 +7,8 @@ #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 200U +#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c" + // Configure the global tapping term (default: 200ms) #define TAPPING_TERM 200 @@ -23,5 +25,13 @@ #define ONESHOT_TAP_TOGGLE 2 #define ONESHOT_TIMEOUT 2000 +// Auto Shift +#define AUTO_SHIFT_TIMEOUT 175 +#define AUTO_SHIFT_REPEAT +#define AUTO_SHIFT_MODIFIERS + +// Retro Shift +#define RETRO_SHIFT 500 + // Caps Word #define CAPS_WORD_IDLE_TIMEOUT 2000 diff --git a/keyboards/crkbd/keymaps/sajenim/keycodes.h b/keyboards/crkbd/keymaps/sajenim/keycodes.h index 5ba4b94..fab45b7 100644 --- a/keyboards/crkbd/keymaps/sajenim/keycodes.h +++ b/keyboards/crkbd/keymaps/sajenim/keycodes.h @@ -38,3 +38,7 @@ #define HOME_I RALT_T(KC_I) #define HOME_A RGUI_T(KC_A) +// Shortcuts +#define PREFIX LCTL(KC_B) +#define DELWORD LCTL(KC_W) +#define ST_PSTE LSFT(KC_INSERT) diff --git a/keyboards/crkbd/keymaps/sajenim/keymap.c b/keyboards/crkbd/keymaps/sajenim/keymap.c index a7852ee..5af78ed 100644 --- a/keyboards/crkbd/keymaps/sajenim/keymap.c +++ b/keyboards/crkbd/keymaps/sajenim/keymap.c @@ -15,62 +15,94 @@ */ #include QMK_KEYBOARD_H +#include + #include "config.h" #include "keycodes.h" -/* Define our keymaps */ +/* Enumeration */ + enum layers { - // Default keyboard layout L_CANARY, - // Standard OLKB layers L_LOWER, L_RAISE, L_ADJUST, - // Extra FN layers L_NAVIGATION, L_SYMBOLS, L_NUMBERS, L_OPERATORS, - L_MACRO, + L_MACRO }; -/* Define our custom keycodes */ enum custom_keycodes { VI_SAVE = SAFE_RANGE, VI_EXIT, HOME, - UPDIR, - DELWORD, + UPDIR +}; + +enum td_keycodes { + TD_YANK, + TD_PSTE }; -/* Define our combos */ enum combos { NE_ESCAPE, - SE_CAPSWORD, - ST_PREFIX, + SE_CAPWRD, COMBO_LENGTH }; + +/* Tapdance */ + +// Define a type containing as many tapdance states as you need +typedef enum { + TD_NONE, + TD_UNKNOWN, + TD_SINGLE_TAP, + TD_SINGLE_HOLD, + TD_DOUBLE_TAP, + TD_DOUBLE_HOLD +} td_state_t; + +// Create a global instance of the tapdance state type +static td_state_t td_state; + +// Declare your tapdance functions: + +// Function to determine the current tapdance state +td_state_t cur_dance(qk_tap_dance_state_t *state); + +// `finished` and `reset` functions for each tapdance keycode +void yank_finished(qk_tap_dance_state_t *state, void *user_data); +void yank_reset(qk_tap_dance_state_t *state, void *user_data); + +void pste_finished(qk_tap_dance_state_t *state, void *user_data); +void pste_reset(qk_tap_dance_state_t *state, void *user_data); + + +/* Combos */ + // Programmatically declare the size of the Combo data structure uint16_t COMBO_LEN = COMBO_LENGTH; // Define key sequences const uint16_t PROGMEM ne_combo[] = {HOME_N, HOME_E, COMBO_END}; const uint16_t PROGMEM se_combo[] = {HOME_S, HOME_E, COMBO_END}; -const uint16_t PROGMEM st_combo[] = {HOME_S, HOME_T, COMBO_END}; // List the combination of keys and there resulting action combo_t key_combos[] = { [NE_ESCAPE] = COMBO(ne_combo, KC_ESC), - [SE_CAPSWORD] = COMBO(se_combo, CW_TOGG), - [ST_PREFIX] = COMBO(st_combo, LCTL(KC_B)), + [SE_CAPWRD] = COMBO(se_combo, CW_TOGG), }; -/* Customise our keymaps */ + +/* Keymaps */ + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [L_CANARY] = LAYOUT_split_3x6_3( //,-----------------------------------------------------. ,-----------------------------------------------------. - KC_TAB, KC_W, KC_L, KC_Y, KC_P, KC_B, KC_Z, KC_F, KC_O, KC_U, KC_QUOT, QK_LEAD, + PREFIX, KC_W, KC_L, KC_Y, KC_P, KC_B, KC_Z, KC_F, KC_O, KC_U, KC_QUOT, XXXXXXX, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_BSPC, HOME_C, HOME_R, HOME_S, HOME_T, KC_G, KC_M, HOME_N, HOME_E, HOME_I, HOME_A, KC_DEL, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| @@ -83,19 +115,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [L_NAVIGATION] = LAYOUT_split_3x6_3( //,-----------------------------------------------------. ,-----------------------------------------------------. - _______, XXXXXXX, XXXXXXX, KC_PGUP, KC_PGDN, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, XXXXXXX, _______, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| _______, OS_LGUI, OS_LALT, OS_LSFT, OS_LCTL, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______ + _______, _______, _______, KC_TAB, _______, _______ //`--------------------------' `--------------------------' ), [L_SYMBOLS] = LAYOUT_split_3x6_3( //,-----------------------------------------------------. ,-----------------------------------------------------. - XXXXXXX, XXXXXXX, KC_LABK, KC_DLR, KC_RABK, XXXXXXX, XXXXXXX, KC_LBRC, KC_UNDS, KC_RBRC, XXXXXXX, OS_OPRS, + XXXXXXX, XXXXXXX, KC_LABK, KC_DLR, KC_RABK, XXXXXXX, XXXXXXX, KC_LBRC, KC_UNDS, KC_RBRC, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_MINS, KC_BSLS, KC_LPRN, KC_DQUO, KC_RPRN, KC_HASH, KC_PERC, KC_LCBR, KC_EQL, KC_RCBR, KC_PIPE, KC_SCLN, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| @@ -119,25 +151,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [L_NUMBERS] = LAYOUT_split_3x6_3( //,-----------------------------------------------------. ,-----------------------------------------------------. - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_SLSH, KC_7, KC_8, KC_9, KC_MINS, _______, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_SLSH, KC_7, KC_8, KC_9, KC_MINS, XXXXXXX, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| _______, OS_LGUI, OS_LALT, OS_LSFT, OS_LCTL, XXXXXXX, KC_ASTR, KC_4, KC_5, KC_6, KC_PLUS, _______, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_0, KC_1, KC_2, KC_3, KC_DOT, _______, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_1, KC_2, KC_3, KC_DOT, _______, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______ + _______, _______, _______, KC_0, _______, _______ //`--------------------------' `--------------------------' ), [L_MACRO] = LAYOUT_split_3x6_3( //,-----------------------------------------------------. ,-----------------------------------------------------. - HOME, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, UPDIR, + HOME, XXXXXXX, XXXXXXX, TD_YANK, TD_PSTE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, UPDIR, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| DELWORD, XXXXXXX, XXXXXXX, VI_SAVE, VI_EXIT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______ + _______, _______, ST_PSTE, _______, _______, _______ //`--------------------------' `--------------------------' ), @@ -167,18 +199,156 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [L_ADJUST] = LAYOUT_split_3x6_3( //,-----------------------------------------------------. ,-----------------------------------------------------. - QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, AS_TOGG, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, AC_TOGG, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, CM_TOGG, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| _______, _______, _______, _______, _______, _______ //`--------------------------' `--------------------------' ), }; -/* Define the behaviour of our custom keycodes */ + +/* OLED */ + +#ifdef OLED_ENABLE +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (is_keyboard_master()) { + return OLED_ROTATION_270; + } else { + return OLED_ROTATION_180; + } + return rotation; +} + +void oled_render_master(void) { + // Layer Status + switch (get_highest_layer(layer_state)) { + case L_CANARY: + oled_write("CANRY", false); + break; + case L_LOWER: + oled_write("LOWER", false); + break; + case L_RAISE: + oled_write("RAISE", false); + break; + case L_ADJUST: + oled_write("ADJST", false); + break; + case L_NAVIGATION: + oled_write_ln(" NAV", false); + break; + case L_SYMBOLS: + oled_write_ln(" SYM", false); + break; + case L_NUMBERS: + oled_write_ln(" NUM", false); + break; + case L_OPERATORS: + oled_write("OPER8", false); + break; + case L_MACRO: + oled_write("MACRO", false); + break; + default: + oled_write_ln(" UND", false); + } + + // Mod Status + uint8_t this_mod = get_mods(); + uint8_t this_osm = get_oneshot_mods(); + + oled_write("-----", false); + + if ((this_mod | this_osm) & MOD_MASK_GUI) { + oled_write("gui:*", false); + } else { + oled_write("gui:.", false); + } + + if ((this_mod | this_osm) & MOD_MASK_ALT) { + oled_write("alt:*", false); + } else { + oled_write("alt:.", false); + } + + if ((this_mod | this_osm) & MOD_MASK_SHIFT) { + oled_write("sft:*", false); + } else { + oled_write("sft:.", false); + } + + if ((this_mod | this_osm) & MOD_MASK_CTRL) { + oled_write("ctl:*", false); + } else { + oled_write("ctl:.", false); + } + + // Feature Status + oled_write("-----", false); + + bool is_autoshift_enabled = get_autoshift_state(); + if (is_autoshift_enabled) { + oled_write("as: *", false); + } else { + oled_write("as: .", false); + } + + bool is_autocorrect_enabled = autocorrect_is_enabled(); + if (is_autocorrect_enabled) { + oled_write("ac: *", false); + } else { + oled_write("ac: .", false); + } + + if (is_combo_enabled()) { + oled_write("cm: *", false); + } else { + oled_write("cm: .", false); + } + + // Caps Word + oled_write("-----", false); + + if (is_caps_word_on()) { + oled_write("cap:*", false); + } else { + oled_write("cap:.", false); + } + + // WPM Status + char wpm_str [4]; + sprintf(wpm_str, "%03d", get_current_wpm()); + oled_set_cursor(1, 14); + oled_write_ln(wpm_str, false); + oled_write(" wpm", false); +} + +void oled_render_slave(void) { + static const char PROGMEM crkbd_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, + 0}; + oled_write_P(crkbd_logo, false); +} + +bool oled_task_user(void) { + if (is_keyboard_master()) { + oled_render_master(); + } else { + oled_render_slave(); + } + return false; +} +#endif // OLED_ENABLE + + +/* Custom Keycodes */ + bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case VI_SAVE: @@ -199,27 +369,155 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case HOME: if (record->event.pressed) { - SEND_STRING("~/"); + SEND_STRING("cd ~/"); + tap_code(KC_ENT); } break; case UPDIR: if (record->event.pressed) { - SEND_STRING("../"); + SEND_STRING("cd ../"); + tap_code(KC_ENT); } break; - case DELWORD: - if (record->event.pressed) { - tap_code16(LCTL(KC_W)); - } - break; } return true; }; -/* Custom layer handling. */ + +/* Tapdance Functions */ + +// Determine the tapdance state to return +td_state_t cur_dance(qk_tap_dance_state_t *state) { + if (state->count == 1) { + if (state->interrupted || !state->pressed) return TD_SINGLE_TAP; + else return TD_SINGLE_HOLD; + } + + if (state->count == 2) { + if (state->interrupted || !state->pressed) return TD_DOUBLE_TAP; + else return TD_DOUBLE_HOLD; + } + + else return TD_UNKNOWN; // Any number higher than the maximum state value you return above +} + +// Handle the possible states for each tapdance keycode you define: + +void yank_finished(qk_tap_dance_state_t *state, void *user_data) { + td_state = cur_dance(state); + switch (td_state) { + case TD_SINGLE_TAP: + register_code(KC_LCTL); + register_code(KC_C); + break; + case TD_DOUBLE_TAP: + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_C); + break; + default: + break; + } +} + +void yank_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (td_state) { + case TD_SINGLE_TAP: + unregister_code(KC_LCTL); + unregister_code(KC_C); + break; + case TD_DOUBLE_TAP: + unregister_code(KC_LCTL); + unregister_code(KC_LSFT); + unregister_code(KC_C); + break; + default: + break; + } +} + +void pste_finished(qk_tap_dance_state_t *state, void *user_data) { + td_state = cur_dance(state); + switch (td_state) { + case TD_SINGLE_TAP: + register_code(KC_LCTL); + register_code(KC_V); + break; + case TD_DOUBLE_TAP: + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_V); + break; + default: + break; + } +} + +void pste_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (td_state) { + case TD_SINGLE_TAP: + unregister_code(KC_LCTL); + unregister_code(KC_V); + break; + case TD_DOUBLE_TAP: + unregister_code(KC_LCTL); + unregister_code(KC_LSFT); + unregister_code(KC_V); + break; + default: + break; + } +} + +// Define `ACTION_TAP_DANCE_FN_ADVANCED()` for each tapdance keycode, passing in `finished` and `reset` functions +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_YANK] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, yank_finished, yank_reset), + [TD_PSTE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, pste_finished, pste_reset) +}; + + +/* Add Home Row Mods to Auto Shift */ + +bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { + switch(keycode) { + // Left hand home-row mods + case HOME_C: + return true; + case HOME_R: + return true; + case HOME_S: + return true; + case HOME_T: + return true; + + // Right hand home-row mods + case HOME_N: + return true; + case HOME_E: + return true; + case HOME_I: + return true; + case HOME_A: + return true; + + default: + return false; + } +} + + +/* Layer Change */ + layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, L_LOWER, L_RAISE, L_ADJUST); } + +/* Post Init */ + +void keyboard_post_init_user(void) { + autoshift_disable(); + autocorrect_enable(); +} diff --git a/keyboards/crkbd/keymaps/sajenim/rules.mk b/keyboards/crkbd/keymaps/sajenim/rules.mk index ec32fc1..931e7fd 100644 --- a/keyboards/crkbd/keymaps/sajenim/rules.mk +++ b/keyboards/crkbd/keymaps/sajenim/rules.mk @@ -6,11 +6,15 @@ BOOTLOADER = rp2040 # Defaults LTO_ENABLE = yes -OLED_ENABLE = no +OLED_ENABLE = yes OLED_DRIVER = SSD1306 # Enable some features CAPS_WORD_ENABLE = yes COMBO_ENABLE = yes LEADER_ENABLE = yes +WPM_ENABLE = yes +AUTO_SHIFT_ENABLE = yes +TAP_DANCE_ENABLE = yes +AUTOCORRECT_ENABLE = yes