forked from forks/qmk_firmware
7639b5aa3e
Keymap Minivan: configurable dual layout, many symbols, speed/text-size measuring * Made center led color follow last activated layer color. Some led code clean up * Reordered the _RAR layer, also putting GUI on the _ACC layer. * Some issue with _FUN (see keymap.c FIXME), removed _FUN nested 'go to layer' key on _FUN. * markdown formatting * Update readme about _FUN top row issue (see keymap.c at XXX) * Sentence order final bit was wrong by topic. White space fiddles. * Minor comment editing * minor comment adjustments * leds are not modifiers, moved * _FUN persistance on base layer only (XXX) * The up/left to go to _LTR layer, now always goes to BASE (_LTR or _DDL). Led indicators refldect this. No _DRA hold on base layer but _ACC. No one shot to _FUN layer (seemed to make things confusing), but a TO(). * Some chatter about how to configure this map to your needs. * language fixing * Tried to make sense explaining how to access the descramble. * language fix * Seems there was a stale CSET_LTR/.*DDL, should be BASE_LTR/.*DDL, fixed. * language, blabla * Corrected stale _LTR into BASE * Some documentation finetuning and trying to make it simple to understand * language fixing * language fixing * Doing the utmost to explain it in a way I understand it too. * language fixing, going ultra-verbose * language fixing and formatting * language fixing * language fixing, formatting * attempt to simplify explanations as much as possible * added License to keymap.c (GPL), noted that _ACC and _DRA need work to function in 'descramble' mode * fixes regarding layer order, adding two layers, started on descramble layers for _ACC and _DRA Unicode * Noted some coming changes about F-layer and more descramble. * changed globals to type 'bool' * Changed F-layer by removing pre-modifier F keys, moved BASE direction switches, added new incomplete descramble layers * _FUN layer changes (comment fix) * Led color fixes. Changed order of layers in the source (no user consequence). * Added copyright authors (hope that is correct in GPL style/requirements). * Switched on BASE layers the keys to activate _MOV with leftside _NSY: more harmoneous, and _MOV can also be held by right hand. * Follow Quantum indentation style more (mostly). * On _NSY & _DDN, Tab follows _LTR. '-' moved to LShift, '.' moved, ',' created, shift(tab) removed. * Added Linux Unicode input mode Accented characters on layers _DDA, _DDD * added to Todo * Added ijIJ to _ACC and _DDA layers (2nd last letter of Dutch alphabet). * add todo point about navigation, fix -> "8th key" * added 「」《》 to _DRA and _DDA * Added 〇, ƒƑ. Altered Nav clusters with paging on outside, added thumb Page up/down to _MOV, brought _REV in line with recent _NSY changes (tab,-,enter,dot,comma). Harmonized tab on _Mov with other layer tabs (also a move command, moving cells). * Added super- and sub-script for numbers on _DRA, _DDD. * Added quotation marks „ “ ” to layers _DRA and _DDD. * Added °〇•· to _DRA, _DDA * § as an enumeration grouped with • (bullet), · as possibly math (middot or multiply) grouped with ±. * Changed numbers to be on home-rows both hands, because thumb layer key does not interfere alternating between hands for longer numbers (previous reason for one-handed numbers). The unshifted symbols went left 2nd row, because then the shifted versions can be accessed with shift if the layout is replicated on a Pok3r (which is non-programmable right hand 2nd row.) The logic has been harmonized with layers _DDN, _DRA & _DDD, _FUN, which have number(-like) keys. It seems better this way. The symbols are layed out more spaciously, each finger now does two symbols (2nd row, 4th row). The numbers are more like they normally are, which feels more natural, and should even the load between both hands and help with alternating between hands when typing numbers. Reason to change was looking into pressing ;, q, j, with ring-, middle-, index-finger (moved one to the right from default Dvorak), because the stagger makes it easier to reach that way, less loss of home row contact, bending fingers more straight up and down. Downside became that left index type 5 numbers, and that the normal finger matching (0 is pinky, etc) was lost. With the new layout these potential problems are also resolved. * Made descramble _DDN, _DDL representation show both raw and resulting layouts. layouts. * Added arrows, fleur and heart on _DRA and _DDD. * Changed _FUN layer switching to incorporate the 'descramble' system seemlessly. The 4 layer with a descramble twin will switch to either depending on the descramble mode. * Descramble mode with normal Unicode layers mostly done, except costum LT() to share the key with Delete/Alt on _DDL. * Changed descramble mode keys to be just one on a cycle. Added full set of Alt/Control/Shift multimodifiers to `_FUN` layer. * Changed descramble mode keys to be just one on a cycle. Added full set of Alt/Control/Shift multimodifiers to `_FUN` layer. * format fix * Descramble cycle key moved from row 1 to row 4 far right, to avoid accidental press, * The 'descramble' mode with normal Unicode encoding finished. Fixed mistaken non-transparent key on _DRA and _DDD, removed tab from _RAR. * stale layer comment fix _LTR/_DDL * New layer-tap timed keys proved unreliable, longer tap term fixed it. * The _FUN layer is a one-shot layer for the F-keys, but that can be toggled by the FUN< key on the _FUN layer (top row, 3rd). Some additions to the readme. * Comment improvements (layout tables) * minor * Made #defines to allow a user to easily switch to a WASD arrow layout. * Added keys to switch leds on/off, to _RAR layer. Fixed wrong comment on 'APP' key in _RAR. * comments fix regarding MLed, SLeds * Added BASE to same key as _FUN on base layer, except layers with numbers/symbols. Removed capital ƒ, and moved ± to that key. Added … on old spot of ±. Some readme language editing, adding something about other keyboards, etc. * small language fix * Config.h: Removed unused #defines. Readme: minor edits. * minor language edits. * Minor comment edit. * Minor language fix. * Minor language style edit. * Removed unnecessary section 'personal remarks' * Changed the top row in _DRA and _DDD. Super-/sub-script parenthesis to that location on _NSY, added currency symbols, reduced emoticons. * minor formatting * Added LGUI and RGUI on the _DRA/_DDD layer(s). * Put RGUI on the base layer, on the _FUN layer switch key. This probably causes side-effects on systems without where RGUI is not merely a modifier. * Changed _FUN toggle on BASE to Rshift, because RGUI on some systems has a consequence when tapped by itself. * Changed LGUI and RGUI around because LGUI is mostly used and on BASE layer. Some edits to last part of readme.md. * Minor language fixed (L/R-GUI, use-case). * some more blabla on use case of the map generally * Changed name KC__[LR]GUI to KC__[XY]GUI for clarity wrt switching them. * Removed left-arrow on Alt on _ACC and _DRA, for faster use with pointer device. * Added the same system as is on RShift, to LShift, pointed it to _MOV layer. * Changed left shift layer toggle to _DRA, because it has uncluttered shift, alt, control, for using those with a pointer device (mouse, stylus). * Changed base layer left-shift tap from _DRA to _MOV, because _MOV toggled can be convenient generally, and it is a less dangerous layer to accidentally press, and it makes more sense to activate the navigation layer when editing in 3D software. * The Power keys on _RAR now require Shift to be activated (accident prevention). * fiddled with title * more title fiddles * Added RGUI on _FUN for future proofing the layout, harmonizing layers. * Added ',' on _REV (number fraction division). Minor fix to documentation format. * title fiddle * Added LGUI, RGUI to _RAR, to harmonize with other layers and for potential future uses. * Changed unnecessary transparent keycode on _AcC and _DDA to be 'nop', minor comment fixes. * Added on _DRA and _DDD: ─━┄┅. Fixed a bug in led layer colors (forgotten 'else', causing wrong color for _DDD). * Some changes to conform to QMK readme.md standards (more necessary). * Changed _REV into a numbers pad layer called _PAD, put on Lshift in BASE. _REV layer (not used anyway) replaced with a layer that is basically a layer where symbols that exist on _NSY (mostly) and on _LTR (few) are existing in the same locations, but in the number pad variant of that symbol. The goal is to make it easy to find, it is not meant for single hand access quickly. The use is to deal with special shortcuts like Blender has, which differentiate normal and numpad numbers/symbols. For quick access it was put on the left shift in BASE layer. * Added navigation arrangements to _PAD. Changed location of shift on _RAR. The numbers on numpad are easy to find, but when these keys are in their navigation variant with numlock on it becomes almost impossible. There was room on the map to add an arrow row, and a row for the remaining navigation keys, hence they where added. They are in a left handed order, because there already is a right handed order on _MOV. It still proved possible to accidentally trigger Power, due to erroneous hitting 'shift' in BASE and then messing around by accident. With shift on (BASE) space in _RAR, accidents should be reduced further, since it is a combination never used. * Added Tab on _ACC and _PAD To facilitate Control-Tab (a blender shortcut). On _ACC the Tab is in its correct place. On _PAD it messy because not on its correct place. Leaving it there for now: easier to access Tab+Control with left hand only on the modifiers in _PAD, and other hand on a pointer device. Tab has a potential use to jump input cells, which may be used in combination with a numpad. * _MOV layer: switched default layout to trangle navigation layout. This only required to set the already existing #defines. I found the flat layout not intuitive, the triangle layout has no left/rigth hand problem. The higher buttons for the mouse where not correctly ordered, so they where re-ordered. * Triangle navigation by default. Added pictures of layout to readme.md * Layer names on images. * Changed image for layer _DRAW slightly. The shifted symbol to the lower right. * Image for _PAD corrected for no-action and Tab. * Added a paragraph about why this layout is good to use. * removed 'modifiers' paragraph * Some text improvements in paragraph on what is good about this layout. Fiddle on the title as well. * Added Del on _DRAW layer. Some minor text fiddles here and there. * Removed word "descramble" in image layer _RAR. * Improved key 'sticky' and altered image size (test). * Rescaled image for layer FUN * Unicode in its own file. Bug fix: _DDA 'ï' printed a capital. Upon a suggestion from QMK Discord #programming, the macros and unicode is put in a separate file, because keymap.c got large. An erroneous numerical value for ï was fixed. Author e-mail is updated to a new e-mail adres. * Added an image to illustrate 'descramble' mode. * Changed explicit e-mail to link, to reduce spam bot trolling. * Added a Qwerty+Dvorak compile time version. It seemed the overall design (accented, Unicode, stuff) could be useful for Qwerty typers (of which there are so many). This was done by #if(n)def out/in a fair amount of code here and there, and creating 4 replacement layers in a new file qwerty_dvorak.c, also with its own readme in qwerty_dvorak.md. The 'descramble' switch system is re-used here to switch from Qwerty to Dvorak. The new code is put in qwerty_dvorak.c, which starts with an extensive comment about why and how it works. Fix: Docs, a stale "_MOV" was replaced with "_PAD" in the readme.md for _DDL. * Changed image hosting. Downtime, problems registering: resorting to my own domain. * minor text order changes * Some text improvements. * Added a compile option to easily change what layer is active on startup. This layer can be plain Dvorak or 'descrambled' Dvorak, if QWERTY_DVORAK is not set. It can be Qwerty or Dvorak if it is set. Just some simple #define statements. * Added graphics for Qwerty+Dvorak, and improved documentation. Added the whole set of layers also to qwerty_dvorak.md, because it seemed it would get even more confusing to have a user cross reference it between the two files. * Some simple text improvements * Numbers/symbols layer keys on BASE to DRAW when both pressed. The two keys besides the space bars go to DRAW layer when pressed simultaneously. (This is inspired on the Planck's 'adjust' layer, pressing both 'lower' and 'raise' together.) All layers can now (relatively) comfortably be reached. This change was necessary because it was cumbersome to reach the DRAW layer with the right pinky and then type with the right hand. _RAR is now not super easy, but it is a 'rare' layer anyway. * Added compile + flash section in readme. * Corrected documentation: 'mouse on ... hand' * Removed up/down arrow ⮙⮛ on _DRA and _DDD, because the hex file was too large. Due to pulling the master repository, changing nothing in this keymap, the code compiled as 2 bytes too large, where before it had been 2 bytes left free. Some compile options have been created, to make it easy to cut out up/down arrow on the 'descramble' _DDD layer, and/or the normal _DRA layer, and/or dashes ┄┅ on the 'descramble' _DDD layer. The 'normal' layer cut out of arrows yields little benefit, but it keeps all layers exactly the same between 'descramble' and normal mode. For Qwerty compilation, you will want to not cut out anything, requiring to edit the user compile options in keymap.c (top). * Resolved size issue with QMK #defines, re-instated ⮙⮛, removed RGUI on _FUN. Various #defines tested to reduce space, NO_ACTION_MACRO NO_ACTION_FUNCTION worked. Therefore the cutting out of the up/down arrows was no longer needed. The #defines to easily remove them have been left in place. RGUI made _FUN confusing with the multi-modifiers, thus taken out. Multi- modifiers now logically cascade without skipping a key. * Improved image files with led colors and some tweaks. * Updated graphics file for Dvorak in QWERTY_DVORAK compile option. The led colors where not correct because the graphics for standard Dvorak was being re-used. * Fixed for re-instating arrow up/down for space. * Activation marker on _FUN layer in documentation altered. It looked like it was a symbol. * Made startup layer explicit in code. Startup layer follows 'descramble' on/off user #define setting. * Marker for BASE activation for _PAD, _MOV: fixed. There was a stale marker in the documentation layouts for _MOV: removed. The same marker for _PAD was improved. * Code optimizations suggested on pull request #8066 https://github.com/qmk/qmk_firmware/pull/8066 Some things moved to config.h, rules.mk Changed layer_on/_off to layer_move(..) Removed a global variable, changed literal type on a function. Code is now a lot smaller, hence removed readme.md entry on that. Removed "not shown" on 'descramble' leds in qwerty readme (mistake). * Compile option to change ƒ into €. Since it's a west european keymap, maybe someone likes the euro currency on it. (It was not on it because I don't like ...) * default to ƒ on keymap * Removed print sheet for layout *.odt file. Changing this to text/markdown seems to reduce the use of this file to a point that it may be better to delete it. There is also the graphics now, which might be better to print. * Updated the seller/maintainer of the board to: The Key Dot Company LLC. https://thekey.company/blogs/blog-updates/thekey-company-acquires-minivan * Changed external links to website to plain text. The markdown link is caught by the github cammo system. * Last free spot on the map made easy to configure. One spot was still free (Unicode _DRA/_DDD layer). This puts a #define on top of unicode_macros.c, to make it easy for a user to put in their own symbol. Put placeholder 🛠 in there. That symbol is not represented in the documentation (maybe it should, it is a nice symbol). * Removed space saving #defines. These became obsolete clutter, now that there is enough space thanks to LINK_TIME_OPTIMIZATION_ENABLE. * Added tokens to simplify compiling for 45/46 keys. An attempt to make it easy to switch on a #define between various hardware configurations (44, 45, 46 keys) failed. This: #define J1 , KC_A // seems to have failed to be recognized as a key definition. error: error: macro "LAYOUT_command" requires 45 arguments, but only 44 given Left in are some code tokens (J1-J4) and #defines that need at least bulk replacement in keymap.c and optionally qwerty_dvorak.c, to compile for such hardware configurations. It would be nice if this could be done better. * User can easily compile for 45, 46 hardware keys. Added some #ifdefs around optional keys in the keymap, to allow compiling for 45 and 46 keys. Left the earlier made code with the J1_J2 etc. tokens, which could still be used to port the map to a board with even more keys. This fixes earlier mentioned problem. * Arrow cluster for 'arrow' hardware configuration. This is a user configurations option in the keymap.c, to have an arrow cluster around the additional key for 'arrow' hardware. The arrow cluster is however not on the base layer (no room). The additional key is used to switch to the _MOV layer. There it becomes a down arrow in the arrow cluster. To make this work with the default _MOV layer, the right hand keys on the 2nd row where moved one spot to the left, for the 'triangle' arrow configuration (mouse right). This is a trivial change. There was a bunch of language improvements to the documentation, including graphics. The symbol 🛠 is now listed. The program seems to be reliable, as far as used and tested. * Correction of mark-down formatting. _MOV layer 'arrow' cluster documentation rendered incorrectly (attempt to add newline). * Markdown formatting mistake correction. Adding a newline at 'Layers (text)' chapter. * Moving the graphics about 'arrow' to topic. The graphic explaining what 'arrow' with arrow cluster means, should be where that is mentioned under compile options. * Editor token J3_J4 moved to avoid arrow cluster. If one wants to insert a key by bulk replacing J3_J4, and has activated the 'arrow' layout arrow cluster, this new key would be inside the arrow cluster, hence it was moved to the left. * Æstethics of image 'arrow' layout, arrow cluster. Shading corrected/nicer. * Corrected image link in readme.md Illustration 'arrow' layout, arrow cluster. * Fix: Toggle to BASE layer leaked. South-paw key. When toggling to a non-BASE layer, either on the _FUN layer or using the 'arrow' cluster for 'arrow' layout, on the BASE layer to toggle to _MOV, the layer changed on the down-stroke, causing a character to leak. These layer switch macros now alter layer on the up stroke. There seems to have been an accidental code deletion: #define MORE_key1. This defines what the additional hardware key for 'South Paw' ('Command') should be. * User compile option comments easier to read. The phrases "uncomment" and "comment out" are confusing. Replaced by _activate_ and _remove_. * Put user compile options back to default Minivan. Accidentally left the compile options for number of Minivan keys in the wrong state while git pushing. * Rewording a comment in the user compile options. Clearer language. * Leds indicate Caps/Num-lock. Leds green/blue switch depending on numlock for numbers-pad layer _PAD. BASE layer led brightens when capslock is on. * _PAD had the wrong period, fixed. _PAD layer had the KC_DOT instead of KC_KP_DOT. * Options for navigation keys arrow hardware key. Compile options added to have a complete navigation cluster around the additional hardware key for 'arrow' layout, both for triangle left handed arrows and flat right handed arrows. * Added _FUN layer in text Qwerty. _FUN text layer was by mistake missing/deleted in the qwerty-dvorak readme. * Added graphical visualization of all layers. * Graphics: _RAR 'Capslock', _NSY '~' corrected. Text representation of layers was correct, graphics corrected. * Compile Option arrows in a vi(1) editor layout. Vi(1) is a much loved editor, with its own peculiar arrow layout on HJKL (as it appears in Qwerty). It seems possible some Qwerty vi users might find it fun this way for regular arrows as well. The 'arrow' hardware layout, compiled with arrow cluster, follows the vi(1) arrow arrangement. * More layer overview graphics files for the readmes. Added a '40% x 400%' to the 3D layer overview image (top). Added overview of all layers in a readable way (Dvorak² only). Added a guide to show where what is similar on layers. This should help with learning. Added a graphic showing what key activates what layer. Added graphics that show what layer subsets are active in certain modes (Dvorak² and Qwerty/Dvorak). Fixed mistake: _Tab_ missing in layer `_PAD` graphics file. * 'Tab' inserted in overview graphics for _PAD layer. * Corrected mistake in similar layer keys. LGUI on _ACC * Added overview graphics for Qwerty/Dvorak. Overview of layers, similar keys on similar layers, activation. * Compile option to change ⮘ ⮙ ⮚ ⮛ into ☐ ☒ ☑ 🗹 Layer _DRA, _DDD. Checkboxes seem handy for lists. Set default on in keymap.c. Pointers seem rarely useful. Right arrow sometimes as a bullet point marker. All affected graphics updated. * First overview image correction. Last layer is not 'symbols' due to its numbers. Some art improvement. * Minor tekst correction (author Minivan config). * Short features overview and git lib fix. * note⁴ as example * Improvements all over the place. The keymap is now modular dual layout. There is a common system, and there can then be two letter/numbers layer pairs be compiled with it, which are separately defined and documented in ./bases… files. Speed measuring and text size counting added. There is an additional Unicode layer, for a total of three. The “descramble Dvorak” layer is now just a function, as was originally intended. * Wrong link to Dvorak manual, stray ‛r’ character. * Splitting the layouts so they are not pairs of 4. The layers had been configurable only as a set of a BASE and letter layer with another BASE and letter layer: Dvorak + Dvorak² and Qwerty+Dvorak. Now Dvorak, Dvorak² and Qwerty can be individually configured, to be on either the Default or Alternate spots in the dual layout (Dvorak² only supports Alternate, due to its “_HALF_ descramble” mode). * Added Colemak layout. Some tidying up of documentation wrt DEF/ALT base layer identifiers. Fixed missing ‛:’ on the graphics for Qwerty. * stale letter * fix modified submodules * removed redundant code testing twice for non-zero * Speed measuring precision fix. The calculation of “int speed;” caused great loss of precision. * Added overview of layers by key. Makes it easier to see the associations of meanings per key. * Dvorak descramble by key overview Forgot to add. * Minor readme format fiddle. * Graphics: blank keys are grey, fix one mistake. * Compilation as a single layout. Layer definitions _ALT_BASE and _ALT_NSY (enum) are simply #redefined as preprocessor numbers equal to _DEF_BASE and _DEF_NSY (see user_config.h, lowest reference to MINIFAN_SINGLE_LAYOUT). * Single layout compile option See user_config.h lowest reference to MINIFAN_SINGLE_LAYOUT for the why of the how. * RShift toggles to _RAR when held ≥ 500 ms. “Qwerty with arrows on BASE”, will need a key to _RAR layer. It mirrors the behavior of LShift. It is generally useful. Removed useless user options regarding LShift layer toggle. It will have to be _PAD. * Layer switch graphic update per last push. Forgot to update the default base layer switching graphic. * Preconfigured optional ‛Command’ hold key to _RAR layer. This is a third way to reach the _RAR layer, useful if the furthest right key on row 1 is changed to an uncluttered BASE layer arrow. This further prepares the way for a Qwerty layout with arrows on BASE. * Changed ‛Command’ hardware key to TG(_RAR) MO(_RAR) doesn't work, because it doesn't follow a change in base layers, which happens on _RAR. * Corrected wrong all-layers-by-key upload readme.md * More graphics = more fun: keycap view in readme. Preparing to integrate a number pad base layer. Shortened hold time for right/left Shift layer toggles to 200 ms. * Too light grey for “1470” on three layout graphics. * Added a numbers pad Base layout option. This numbers pad layer is in the format of a numbers pad keyboard/cluster. It has a second layer, which is normal for all Base layers. In this case, the second layer provides sub-/super-script versions of the numbers, in the same layout. * Keycap view numpad improvements. * Graphics: forgot to cut off southpaw/arrow on two keycap views. * Preprocessor identifier for “MIT” Planck spacebar. Trans-minivan preprocessor statements augmented with an identifier which might work for a Planck keyboard with two unit spacebar. At this point, the “trans minivan” code only could make porting to other keyboards less of a chore. It remains untested. Only visual inspection of the preprocessing regarding the amount of keys in the layout has been done. * Tweak of common layout graphic impression. This would also allow indication of a number pad. * Improved dual numpad layer & graphics. All numbers/symbols seem to get affected by NumLock, hence they all needed to show that in the graphic documentation. Tab was removed in favor of Numpad ‛=’, and comma replaced by numpad-comma. * Committing partial job on numpad Base layers. Hardware problem here, don't want to loose the data. * Three issues: header file, numpad Base, Tab key. This should complete previous unexpected commit. ① Documentation and precedent for a base layer with its own header file, base_NAME.h. This allows someone writing a new Base layer pair, to (un)set user configuration options in user_config.h. ② Numbers pad Base layer added, different variants. The common numbers pad also has a new optional layout (square), and can be removed by user configuration option (because one might already compile with the Base layer numbers pad).. ③ It turns out there was an easy solution to the Tab key anomaly. Uncluttered Tab is now located both on BON and ACC layers, on intuitive locations opposing Control, which is also in the right spot. Basic modifiers for Tab works well now. * Graphics for Base numpad single square: correction. Showed wrong insertion key for 'command' / 'south paw' hardware key. … * ‛South paw’ default GUI. Graphics. TOC user config. Made ‛south paw’ be GUI by default. Improved graphics appearance. Ordered options in user_config.h, added table of contents. * User config cleanup & added a compact alternate. The normal user configuration, which is heavily documented and therefore a bit unwieldy, can now optionally be done in another file, without any documentation. * Base graphics fix, _ACC/_NSY hold switch option * Added a Qwerty with arrows on base. Added a graphic in readme for Dvorak descramble (for documentation predictability). * Put `~ on the _BON layer. ① There was no uncluttered `~ available. On Qwerty Base Arrow the `~ key got even more sidelined. ② Improved Qwerty Base Arrow manual. * Option to harmonize Qwerty with Qwerty Base Arrow Key ‛/?’ is different on Qwerty Base Arrow, which will lead to typing arrows for people who have both kinds of Qwerty running. This option adds this key in the same spot as where it is on Qwerty Base Arrow, but only if Qwerty Base Arrow is being compiled. * See previous commit (Qwerty harmonization) * Efficiency fix. +Workman layout. Workman layout added. Serious efficiency mistakes discovered and fixed: ① There was no check on Delete on Base layer, to see if another key had been pressed. Fixed. ② The Shifts on Base did not provide a Shift for the _BON layer accented characters. Fixed. Fixing was painless, proving the code is stable and maintainable. * Changed Tab/CTL on _ACC/_DRA, μ, T.O.C. readme.md μ was forgotten (French), added on _ACC. This caused Tab to get displaced and stacked with Control, which ends up being better anyway. This also meant _ACC needed Left-Control, and therefore _DRA needed to switch Tab and Control, because it needs to complement _ACC with Right-Control (to be able to type all modifiers with Tab). ➡ Overview graphics are not yet updated. _DRA and _ACC are now out of sync in the graphics documentation. To be fixed soon. Chapter on language support added in readme. Table of Contents added to readme. * Updated all graphics (_BON/_DRA Tab/Control/μ). Some fiddles with readme. * Led on/off at startup, RAlt on Base option. It is hard to believe, but the todo que seems empty! * Minor changes in readme. * Minor documentation improvement (RAlt/_RAR). * Minor changes readme. Removed “not tested yet …”, because that becomes wrong once it is tested. * Added a blank keycaps graphic. * Lower saturation letters Dvorak-descramble keycap. ;-] * One key change in personal keycap graphic. ;-] * Forgot _NSY layer in keycap qwerty basearrow * Moved speed/count startup setting in user_config.h Moved to chapter startup settings. (These last commits are more like some loose ends with the last ongoing topics. It isn't active development, nothing new gets started. If QMK requests more changes, even if it is a typo, just let me know.) * Travis Cl: “The LINK_TIME_OPTIMIZATION_ENABLE flag… … has been renamed to LTO_ENABLE.. Stop.” Changed it. * Adds a link to external resources in readme. A place to put gimp .xcf files if someone wants to modify/port the keymap. Perhaps links to varieties of Minifan on github. Maybe a video about the keymap, and such. Stuff that doesn't belong/fit on github, and is easy to update without pull requests. * RGBLIGHT_ENABLE rules.mk fixed, leds off for nop rules.mk RGBLIGHT_ENABLE can now be set to “no” without issue. Compile option to have leds off in Default Base layer. * Transparency bug fixed. Default layer was not set. This remained a hidden mistake, until Qwerty Base Arrow had a different layer hold key in one place. * Graphics doc correction, L/Rshift toggle config Qwerty Base Arrow fix: Keycap view showed unneeded and empty ‛South Paw’ key. All layers by key shows 45 Minivan version, title said “44”. Added user configuration options to alter what is on the short and long toggle on Left and Right Shift. * Improved “why this layout” in readme. Wanted to add that numbers & symbols layer can be reached by both thumbs. It seems quite a drawback if that is not possible, to constantly need to hold down the same thumb, especially for programming ? It seemed worthwhile to mention. * Reduced size of readme, dvorak-descramble, todo. Stuff got a bit out of hand. * one letter typo * renumbered readme, _fun_stay initialization Renumbered readme chapters to start from 1 not 0. Other minor edits. Sticky on/off for _FUN layer seemed to be unpredictable on startup. * Letter Ñ (capital) fix. I seem to remember messing with this recently, must have damaged this letter :-(. Capital was missing. * Bare bones base numpad all layer by key. I seemed to have forgotten to hide the common layers for this version. Which doesn't matter a whole lot but this is a bit better and as it was meant.
2273 lines
78 KiB
C
2273 lines
78 KiB
C
/*
|
||
* License (GPL):
|
||
|
||
This program is free software: you can redistribute it and/or modify
|
||
it under the terms of the GNU General Public License as published by
|
||
the Free Software Foundation, either version 2 of the License, or
|
||
(at your option) any later version.
|
||
|
||
This program is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU General Public License for more details.
|
||
|
||
You should have received a copy of the GNU General Public License
|
||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
||
* Author: © 2019, 2020 by Jos Boersema
|
||
*
|
||
*/
|
||
|
||
/* This file contains mostly the Unicode and special macros.
|
||
It contains the function: process_record_user(...)
|
||
*/
|
||
|
||
#include "./unicode_macros.h"
|
||
#include "./unicode_weurope.h"
|
||
|
||
// Definition of ƒ (Dutch currency symbol).
|
||
// Best changed in user_config.h, if you like a Euro symbol instead.
|
||
//
|
||
# ifndef UNICODE_CURRENCY // Prior optional definition in user_config.h
|
||
# define UNICODE_CURRENCY 0x0192 // Hex number. The unicode hex number for position ƒ in the default keymap.
|
||
# endif
|
||
|
||
//
|
||
// 🛠
|
||
#define CS_USER_DEFINED 0x1F6E0 // Hammer & wrench (place holder).
|
||
|
||
#define DIV10POINT TRUE // suggest to function write_number, to divide by 10 and print as a fraction: N.N
|
||
|
||
// Converts integer value to Unicode. Also handles 'descramble' Unicode mode for DVORAK_DESCRAMBLE_HALF.
|
||
// Unicode is a hexadecimal string (character) representation of the value, with a pre- and post-fix.
|
||
void unicode_hex2output (long unsigned int unshifted, long unsigned int shifted) {
|
||
|
||
long unsigned int input; // which argument to work on
|
||
char output[10] ; // will hold the ascii for output
|
||
int index; // count backwards 'to left' in the string
|
||
long unsigned int bitmove; // move computation to next digit.
|
||
long unsigned int work; // temporary value for computation
|
||
|
||
|
||
// What to work on
|
||
if(shift_ison) input = shifted; // Trying to get everything possible here in this function, to reduce firmware size.
|
||
else input = unshifted;
|
||
|
||
//if (input < 0) input *= -1; // positive value
|
||
|
||
// Take the hex value 4 bits at a time, starting with the least significant, convert to ascii, store
|
||
index = 9;
|
||
output[index] = '\0'; // terminator
|
||
bitmove = 0x1;
|
||
while ((work = (input / bitmove)) && (index >= 0)) {
|
||
index --;
|
||
work &= 0xF;
|
||
if (work < 0xA){ // numbers
|
||
output[index] = work + 0x30; // pad to ASCII
|
||
}else{ // alphas
|
||
# ifdef DVORAK_DESCRAMBLE_HALF // Do the letter descramble if needed.
|
||
if(_FULL_ == alternate){ // 0-9=0-9, a=a, b=n, c=i, d=h, e=d, f=y
|
||
if (0xA == work) output[index] = 'a';
|
||
if (0xB == work) output[index] = 'n';
|
||
if (0xC == work) output[index] = 'i';
|
||
if (0xD == work) output[index] = 'h';
|
||
if (0xE == work) output[index] = 'd';
|
||
if (0xF == work) output[index] = 'y';
|
||
}else{
|
||
output[index] = work - 9 + 0x40; // normal mode
|
||
}
|
||
# else // The above is not relevant for anything else.
|
||
output[index] = work - 9 + 0x40; // normal mode
|
||
# endif
|
||
}
|
||
bitmove *= 0x10; // next digit
|
||
}
|
||
|
||
// Put character(s) out in correct mode
|
||
# ifdef DVORAK_DESCRAMBLE_HALF // Do the letter descramble if needed.
|
||
if (_FULL_ == alternate) { // This is the special 'descramble' output mode for a computer already set to Dvorak
|
||
|
||
SEND_STRING ( SS_DOWN(X_LCTRL) SS_DOWN(X_LSHIFT) "f" SS_UP(X_LSHIFT) SS_UP(X_LCTRL) ) ; // lead-in for Unicode on Linux, 'descramble' mode
|
||
send_string (output + index); // pointer to argument with formatted string
|
||
SEND_STRING ( " " ) ; // Ends the Unicode numerical input mode, replacing input with desired character (Linux)
|
||
|
||
}else{
|
||
// normal QMK Unicode output mode
|
||
send_unicode_hex_string (output + index); // pointer argument
|
||
}
|
||
|
||
# else
|
||
send_unicode_hex_string (output + index); // pointer argument
|
||
# endif
|
||
|
||
}
|
||
|
||
|
||
// Wrapper for unicode keys that do have the same on shift.
|
||
void unicode_hex2output_single (long unsigned int either) {
|
||
unicode_hex2output (either, either) ;
|
||
}
|
||
|
||
|
||
// Required by QMK Unicode
|
||
const uint32_t PROGMEM unicode_map[] = {
|
||
|
||
};
|
||
|
||
// Macro name definitions. The Unicode layers _ACC, _DRA and _BON are defined here,
|
||
// because the Unicode map system does not have enough space (at time of this programming, year 2020).
|
||
enum custom_keycodes {
|
||
|
||
// Macro, allowing the upper left button to switch to either _DEF_BASE base layer, or the _ALT_BASE base layer.
|
||
// Alternate is set on/half/off in the _RAR layer. The word "base" is used to avoid "default," because the default
|
||
// layer system call DF() is not being used.
|
||
CTO_BASE = SAFE_RANGE, // 'C' for costum, "TO" for to, "BASE" for chosen base layer
|
||
|
||
OTHER_BASE, // cycles modes: use _DEF_BASE, _ALT_BASE. For “dvorak²” layout (descramble) compile option, there is a third mode.
|
||
|
||
# if defined(BASE_NUMPAD__ALT_BASE)
|
||
OTHER_BASE_GO, // Like OTHER_BASE, but also immediately switches to the other BASE layer.
|
||
# endif
|
||
|
||
CTO_NUMS, // activates number-symbols layer, taking into account the dual layout mode
|
||
CTO_ACCE, // accented ''
|
||
CTO_DRAW, // drawings ''
|
||
|
||
# ifndef CHOLTAP_ACCE_NOP
|
||
CHOLTAP_ACCE, // Go to accented layer, or others in combination with other keys.
|
||
# endif
|
||
|
||
// Keys can be pressed together for a separate layer (like 'adjust layer' on the Planck).
|
||
DUO_HOLD,
|
||
|
||
CHOLTAP_RSHFT, // Go to _FUN layer, or shift modifier.
|
||
CHOLTAP_LSHFT, // Go to <configurable> layer, or shift modifier.
|
||
CHOLTAP_LAYR, // Go to _RAR layer, or right arrow
|
||
|
||
// Special macro to make F-keys one-shot or not.
|
||
_FUN_STAY,
|
||
|
||
// Layer toggle to be guaranteed on up-key, therefore macro definition here.
|
||
_MOV_UP,
|
||
|
||
// These macros protect the critical keys like 'Power' from accidental press, by needing Shift to be pressed.
|
||
C_KC_PWR, // Powers computer off.
|
||
C_KC_WAKE,
|
||
C_KC_SLEP, // sleep computer
|
||
C_KC_PAUS, // pauze computer
|
||
|
||
// Toggles side leds on/off.
|
||
LEDS_ON,
|
||
RGBTOG_,
|
||
|
||
// Typing speed measuring
|
||
SPEED_TOG,
|
||
SPEED_REPORT,
|
||
|
||
// Word/character counting
|
||
COUNT_TOG, // starts word counting
|
||
COUNT_REPORT, // writes to the computer as if typing, gives count report
|
||
COUNT_WORDMIN, // reduces the word count
|
||
COUNT_NULL, // resets count to zero
|
||
LT__MOV__KC_ENT, // move to layer _MOV, or <enter>
|
||
|
||
// The _ACC layer, additional Unicode.
|
||
# ifndef REMOVE_ACC // This cuts out the whole _ACC layer.
|
||
XP_ACC_AA ,
|
||
XP_ACC_AB ,
|
||
XP_ACC_AC ,
|
||
XP_ACC_AD ,
|
||
XP_ACC_AE ,
|
||
XP_ACC_AF ,
|
||
XP_ACC_AG ,
|
||
XP_ACC_AH ,
|
||
XP_ACC_AI ,
|
||
XP_ACC_AJ ,
|
||
XP_ACC_BA ,
|
||
XP_ACC_BB ,
|
||
XP_ACC_BC ,
|
||
XP_ACC_BD ,
|
||
XP_ACC_BE ,
|
||
XP_ACC_BF ,
|
||
XP_ACC_BG ,
|
||
XP_ACC_BH ,
|
||
XP_ACC_BI ,
|
||
XP_ACC_BJ ,
|
||
XP_ACC_BK ,
|
||
XP_ACC_CA ,
|
||
XP_ACC_CB ,
|
||
XP_ACC_CC ,
|
||
XP_ACC_CD ,
|
||
XP_ACC_CE ,
|
||
XP_ACC_CF ,
|
||
XP_ACC_CG ,
|
||
XP_ACC_CH ,
|
||
XP_ACC_CI ,
|
||
XP_ACC_CJ ,
|
||
# endif // REMOVE_ACC
|
||
|
||
# ifndef REMOVE_DRA // This cuts out the whole _DRA layer
|
||
// The _DRA layer, additional Unicode.
|
||
XP_DRA_AA ,
|
||
XP_DRA_AB ,
|
||
XP_DRA_AC ,
|
||
XP_DRA_AD ,
|
||
XP_DRA_AE ,
|
||
XP_DRA_AF ,
|
||
XP_DRA_AG ,
|
||
XP_DRA_AH ,
|
||
XP_DRA_AI ,
|
||
XP_DRA_AJ ,
|
||
XP_DRA_BA ,
|
||
XP_DRA_BB ,
|
||
XP_DRA_BC ,
|
||
XP_DRA_BD ,
|
||
XP_DRA_BE ,
|
||
XP_DRA_BF ,
|
||
XP_DRA_BG ,
|
||
XP_DRA_BH ,
|
||
XP_DRA_BI ,
|
||
XP_DRA_BJ ,// XP_DRA_BK , // no 'BK' key definition on this layer
|
||
XP_DRA_CA ,
|
||
XP_DRA_CB ,
|
||
XP_DRA_CC ,
|
||
XP_DRA_CD ,
|
||
XP_DRA_CE ,
|
||
XP_DRA_CF ,
|
||
# endif // REMOVE_DRA
|
||
XP_DRA_CG , // Needed for ☑ on Unicode tester key in _RAR
|
||
# ifndef REMOVE_DRA // This cuts out the whole _DRA layer
|
||
XP_DRA_CH ,
|
||
XP_DRA_CI ,
|
||
XP_DRA_CJ ,
|
||
# endif // REMOVE_DRA
|
||
|
||
// The _BON layer, additional Unicode.
|
||
# ifndef REMOVE_BON // Removes this layer entirely, if set.
|
||
XP_BON_AA ,
|
||
XP_BON_AB ,
|
||
XP_BON_AC ,
|
||
XP_BON_AD ,
|
||
XP_BON_AE ,
|
||
XP_BON_AF ,
|
||
XP_BON_AG ,
|
||
XP_BON_AH ,
|
||
XP_BON_AI ,
|
||
XP_BON_AJ ,
|
||
XP_BON_BA ,
|
||
XP_BON_BB ,
|
||
XP_BON_BC ,
|
||
XP_BON_BD ,
|
||
XP_BON_BE ,
|
||
XP_BON_BF ,
|
||
XP_BON_BG ,
|
||
XP_BON_BH ,
|
||
XP_BON_BI ,
|
||
XP_BON_BJ ,
|
||
XP_BON_BK ,
|
||
XP_BON_CA ,
|
||
XP_BON_CB ,
|
||
XP_BON_CC ,
|
||
XP_BON_CD ,
|
||
XP_BON_CE ,
|
||
XP_BON_CF ,
|
||
XP_BON_CG ,
|
||
XP_BON_CH ,
|
||
XP_BON_CI ,
|
||
XP_BON_CJ ,
|
||
# endif // REMOVE_BON
|
||
};
|
||
|
||
// Pre-existing function, called for every key up and down.
|
||
// This function is sortof the hub of the whole thing.
|
||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||
|
||
// User input for the word count menu
|
||
if (sizecount_menu) {
|
||
if (record->event.pressed) { // key down
|
||
|
||
switch (keycode) {
|
||
case KC_0: // read in how many is maximum
|
||
sizecount_max = (sizecount_max * 10);
|
||
break;
|
||
|
||
case KC_1:
|
||
sizecount_max = (sizecount_max * 10) + 1;
|
||
break;
|
||
|
||
case KC_2:
|
||
sizecount_max = (sizecount_max * 10) + 2;
|
||
break;
|
||
|
||
case KC_3:
|
||
sizecount_max = (sizecount_max * 10) + 3;
|
||
break;
|
||
|
||
case KC_4:
|
||
sizecount_max = (sizecount_max * 10) + 4;
|
||
break;
|
||
|
||
case KC_5:
|
||
sizecount_max = (sizecount_max * 10) + 5;
|
||
break;
|
||
|
||
case KC_6:
|
||
sizecount_max = (sizecount_max * 10) + 6;
|
||
break;
|
||
|
||
case KC_7:
|
||
sizecount_max = (sizecount_max * 10) + 7;
|
||
break;
|
||
|
||
case KC_8:
|
||
sizecount_max = (sizecount_max * 10) + 8;
|
||
break;
|
||
|
||
case KC_9:
|
||
sizecount_max = (sizecount_max * 10) + 9;
|
||
break;
|
||
|
||
case KC_C: // count characters
|
||
sizecount_max_type = SIZECOUNT_CHAR;
|
||
sizecount_menu = FALSE;
|
||
break;
|
||
|
||
case KC_W: // count words
|
||
sizecount_max_type = SIZECOUNT_WORD;
|
||
sizecount_menu = FALSE;
|
||
break;
|
||
|
||
// Anything else ends menu input.
|
||
case KC_DOT:
|
||
case KC_ESC:
|
||
sizecount_menu = FALSE; // break out
|
||
break;
|
||
|
||
}
|
||
if (!sizecount_menu) { // end
|
||
send_string ("->");
|
||
write_number (sizecount_max, FALSE); // just indicate something
|
||
}
|
||
}
|
||
}
|
||
|
||
// Go back to base-layer after pressing an F-key, on key-up to avoid BASE key activation
|
||
if ((_fun_stay == FALSE) && //
|
||
(((keycode >= KC_F1) && (keycode <= KC_F12))
|
||
||
|
||
((keycode >= KC_F13) && (keycode <= KC_F24)))) { // assumes keycodes 1-12 and 13-24 are consequtive, which seems likely, although using 1-24 failed (probably not consequtive)
|
||
// Go back to base layer
|
||
if (!(record->event.pressed)) { // key up
|
||
if (alternate) { //
|
||
layer_move (_ALT_BASE);
|
||
}else{
|
||
layer_move (_DEF_BASE);
|
||
}
|
||
}
|
||
}
|
||
|
||
// Detect if Shift was pressed in isolation, by seeing if another key was pressed during the time
|
||
// the right shift key was held down.
|
||
// This system is also used by CHOLTAP_ACCE
|
||
// This helps make sure a tapped use of these keys is correctly differentiated from their use as a
|
||
// modifier/layer-hold key. The Shift and CHOLTAP_ACCE should not normally interfere with each other.
|
||
if (isolate_trigger) { // speed: hoping this statement to execute a little quicker overall, than the next
|
||
if ((keycode != CHOLTAP_RSHFT) // not right shift up
|
||
&&
|
||
(keycode != CHOLTAP_LSHFT) // not left shift up
|
||
&&
|
||
(keycode != CHOLTAP_ACCE) // _ACC layer (and others)
|
||
&&
|
||
(keycode != CHOLTAP_LAYR)) { // _RAR layer, or RAlt/Alt-Gr
|
||
isolate_trigger = FALSE; // another key was pressed
|
||
}
|
||
}
|
||
|
||
// This block contains the complex macros, which should not count in speed counting or word/character counting,
|
||
// because they aren't typed characters.
|
||
switch (keycode) {
|
||
|
||
// Typing speed measuring
|
||
case SPEED_TOG: // Toggle speed measuring on/off
|
||
if (record->event.pressed) { // key down
|
||
if (speed_measure) {
|
||
speed_measure = FALSE;
|
||
|
||
# ifdef RGBLIGHT_ENABLE
|
||
rgblight_sethsv_noeeprom (HSV_PURPLE); // indicates stop (_RAR color)
|
||
# endif
|
||
|
||
}else{
|
||
// initialization of measurements
|
||
speed_measure = TRUE; // activates
|
||
speed = 0; // start at 0 k/s
|
||
speed_countdown = SPEED_COUNTDOWN; // reset, speed is measured in batches of keypresses
|
||
speed_counttime = timer_read32 ();// get current time
|
||
speed_add = 0;// speed average accumulator, it keeps adding the *speed* of each batch to this total
|
||
speed_batches = 0; // divider for speed_add to get the average
|
||
|
||
# ifdef RGBLIGHT_ENABLE
|
||
// set middle led
|
||
rgblight_sethsv_noeeprom (HSV_WHITE); // indicates start
|
||
# endif
|
||
|
||
}
|
||
|
||
# ifdef RGBLIGHT_ENABLE
|
||
isolate_rgblight_set ();
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case SPEED_REPORT: // Report the current typing speed by writing it, as if typing
|
||
if (record->event.pressed) { // down
|
||
short added = 5; // This counts how many characters the report itself is adding into the current text,
|
||
// to later delete it from the character count for text-size counting.
|
||
|
||
if (speed_measure) {
|
||
|
||
# ifdef WORDS_PER_MINUTE
|
||
|
||
// The speed is recorded as an accumulation of keystrokes-per-second, times 10 for added precision.
|
||
// This will be converted into words-per-minute by dividing by 5 characters for a word including
|
||
// blank space and punctuation, and multiplied by 60 for seconds per minute. ⁶⁰/₅ = 12. Multiplied
|
||
// by 12 is the simple conversion.
|
||
send_string ("<"); // +1 character written // analogue to '<POWER>'
|
||
added += write_number ((long int)((speed*12)/10), FALSE); // writes the speed
|
||
send_string ("wpm"); // +3 character written
|
||
if (0 != speed_batches) {
|
||
long int average_times_ten ;
|
||
average_times_ten =(long int) ((speed_add * 12) / speed_batches); // *12 converts k/s to wpm
|
||
|
||
send_string (";"); // +① ''
|
||
added += write_number (average_times_ten / 10, FALSE); // writes the average speed, cannot use decimal because precision is not there
|
||
send_string ("wpm"); // +③
|
||
added += write_number ((long int) speed_batches, FALSE); // amount of batches
|
||
send_string ("x"); // +①
|
||
added += 9 + write_number ((long int) SPEED_COUNTDOWN, FALSE); // amount of batches
|
||
send_string ("keys"); // +④ = ⑨
|
||
|
||
speed_led ( (int) (average_times_ten / 12));// on report, show the average
|
||
// we need to convert back to k/s now
|
||
}
|
||
|
||
# else // keystrokes per second, k/s
|
||
|
||
send_string ("<"); // +1 character written // analogue to '<POWER>'
|
||
added += write_number ((long int)(speed/10), FALSE); // writes the speed
|
||
send_string ("k/s"); // +3 character written
|
||
if (0 != speed_batches) {
|
||
long int average_times_ten ;
|
||
average_times_ten =(long int) (speed_add / speed_batches);
|
||
|
||
send_string (";"); // +① ''
|
||
added += write_number (average_times_ten, DIV10POINT); // writes the average speed
|
||
send_string ("k/s"); // +③
|
||
added += write_number ((long int) speed_batches, FALSE); // amount of batches
|
||
send_string ("x"); // +①
|
||
added += 9 + write_number ((long int) SPEED_COUNTDOWN, FALSE); // amount of batches
|
||
send_string ("keys"); // +④ = ⑨
|
||
|
||
speed_led ( (int) average_times_ten );// on report, show the average. speed_led divides by 10
|
||
}
|
||
|
||
# endif
|
||
|
||
send_string (">"); // +1 = 5
|
||
if (sizecount_measure) sizecount_chars += added; // the user is expected to hit <backspace>
|
||
}else{
|
||
send_string ("<Soff>"); // indicates off
|
||
if (sizecount_measure) sizecount_chars += 5; // user: <backspace>, to take it down again
|
||
}
|
||
|
||
key_timer = timer_read ();
|
||
|
||
}else{ // key up
|
||
// This use of the key is for callibrating your colors; it is difficult otherwise to see.
|
||
// This is not part of normal usage, therefore it is kept bare bones to reduce firmware size
|
||
if (timer_elapsed (key_timer) > 999) { // held for one second
|
||
speed += 10;
|
||
write_number ((long int)(speed/10), FALSE); // writes the speed
|
||
speed_led (speed); // update led
|
||
}
|
||
}
|
||
break;
|
||
|
||
case COUNT_TOG: // Toggle start/stop text size measuring
|
||
if (record->event.pressed) { // key down
|
||
|
||
key_timer = timer_read ();
|
||
|
||
}else{ // up
|
||
if (timer_elapsed (key_timer) < 500) { // held for less than half a second (tapped)
|
||
if (sizecount_measure) {
|
||
|
||
sizecount_measure = FALSE;
|
||
|
||
# ifdef RGBLIGHT_ENABLE
|
||
rgblight_sethsv_noeeprom (HSV_PURPLE); // indicates stop (color of _RAR)
|
||
isolate_rgblight_set ();
|
||
# endif
|
||
|
||
}else{
|
||
|
||
sizecount_measure = TRUE; // start counting
|
||
sizecount_word = FALSE; // detect double blanks. leading blanks are not a word
|
||
|
||
# ifdef RGBLIGHT_ENABLE
|
||
if (0 == sizecount_max) {
|
||
rgblight_sethsv_noeeprom (HSV_BLUE); // indicates start/activated, but only without maximum set
|
||
isolate_rgblight_set (); // .. if maximum set, led goes green to red.
|
||
}else{
|
||
rgblight_sethsv_noeeprom (HSV_GREEN); // indicates start/activated, but only without maximum set
|
||
isolate_rgblight_set (); // .. if maximum set, led goes green to red.
|
||
}
|
||
# endif
|
||
|
||
}
|
||
}else{ // held longer
|
||
sizecount_menu = TRUE;
|
||
send_string ("<Nc|w>"); // Menu: N amount, c|w character|word counting. Input is a number then ‛c’ or ‛w’
|
||
sizecount_max = 0;
|
||
}
|
||
}
|
||
break;
|
||
|
||
case COUNT_NULL: // Sets the count to zero, which allows on/off to have a suspend/resume
|
||
if (record->event.pressed) { // key up
|
||
sizecount_blanks = 0; //
|
||
sizecount_chars = 0;
|
||
|
||
# ifdef RGBLIGHT_ENABLE
|
||
rgblight_sethsv_noeeprom (HSV_CYAN); // indicates reset
|
||
isolate_rgblight_set ();
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case COUNT_REPORT: // Report the current typing speed
|
||
if (record->event.pressed) {
|
||
// We assume the user is writing a report in its active document, and then likely deleting it.
|
||
short added = 0; // This counts how much characters the report adds into the user document.
|
||
|
||
if (sizecount_measure) {
|
||
send_string ("<"); // + 1 and ① characters (1 is one logical stream, ① another)
|
||
if (0 == sizecount_max) { // no size counting maximum, print both characters and words
|
||
|
||
added += write_number (sizecount_chars, FALSE); // returns how many characters where printed
|
||
send_string ("c;"); // + 2
|
||
added += write_number (sizecount_blanks, FALSE) + 5; // adds here
|
||
send_string ("w>"); // + 2 = 5
|
||
|
||
}else{ // Only show the one for which the maximum is set, don't throw off that mental focus
|
||
if (SIZECOUNT_WORD == sizecount_max_type ) {
|
||
|
||
added += write_number (sizecount_blanks, FALSE) + 3;
|
||
send_string ("w>"); // + ② = ③
|
||
|
||
}else{ // characters
|
||
|
||
added += write_number (sizecount_chars, FALSE) + 3; // returns how many characters where printed
|
||
send_string ("c>"); // + ② = ③
|
||
|
||
}
|
||
// add current maximum setting
|
||
send_string ("["); // + 1
|
||
added += write_number (sizecount_max, FALSE) + 3;
|
||
if (SIZECOUNT_WORD == sizecount_max_type) send_string ("w]"); // + 2
|
||
else send_string ("c]"); // + 2
|
||
}
|
||
sizecount_chars += added; // Account for the written characters in the report itself.
|
||
|
||
}else{ // no size counting, also here: keep the report terse
|
||
send_string ("<Coff>"); // indicates off (no need to add to count, since counting is off)
|
||
}
|
||
}
|
||
break;
|
||
|
||
// This allows the user to manually remove word counts, when he has deleted a word.
|
||
// This is not needed for character count, because <backspace> counts as minus.
|
||
case COUNT_WORDMIN: // Take down one word in the word-count.
|
||
if (record->event.pressed) { // down
|
||
key_timer = timer_read ();
|
||
}else{ // up
|
||
if (timer_elapsed (key_timer) < 500) { // held for less than half a second (tapped)
|
||
sizecount_blanks--;
|
||
}else{
|
||
sizecount_blanks -= 10;
|
||
}
|
||
}
|
||
break;
|
||
|
||
// Shift detection system.
|
||
// Disused because it turned out 'one shot' like Unicode input. Shift detection copied from.
|
||
// https://github.com/kyleterry/qmk_firmware/blob/master/quantum/quantum.c
|
||
//uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT));
|
||
|
||
// Crude but self contained in this source file shift detection.
|
||
// ... right shift
|
||
case KC_RSFT:
|
||
// + ... left shift
|
||
case KC_LSFT:
|
||
if (record->event.pressed) { // key down
|
||
shift_ison = 1; // shift depressed
|
||
}else{ // key up
|
||
shift_ison = 0; // shift released
|
||
}
|
||
// There are macros on Shift who also alter this variable.
|
||
break;
|
||
|
||
case OTHER_BASE: // Switching through the default/alternate BASE modes, and Descramble for that Dvorak compile
|
||
if (record->event.pressed) {
|
||
;
|
||
}else{ // key up
|
||
|
||
// Cycles through the modes
|
||
# ifdef DVORAK_DESCRAMBLE_HALF // version Dvorak+Dvorak-descramble has 3 modes
|
||
if (_NORMAL_ == alternate) {
|
||
alternate = _FULL_;// alternate layers
|
||
default_layer_set (_ALT_BASE_MASK); // This is needed only for a rare case,
|
||
// where _DEF_BASE and _ALT_BASE their layer switching keys don't line up,
|
||
// such as with Qwerty Base Arrow
|
||
} else if (_HALF_ == alternate) {
|
||
alternate = _NORMAL_;// normal layers
|
||
default_layer_set (_DEF_BASE_MASK);
|
||
}else{ // _FULL_ == alternate
|
||
alternate = _HALF_;// alternate layers, without 'descramble' recomputing Unicode
|
||
//default_layer_set (_ALT_BASE_MASK);
|
||
// it cycles, and this comes always after it was set _FULL_
|
||
}
|
||
# else // Only switching the BASE layers between alternate and default
|
||
|
||
if (_NORMAL_ == alternate) {
|
||
alternate = _FULL_;// alternate base layers
|
||
default_layer_set (_ALT_BASE_MASK);
|
||
}else{
|
||
alternate = _NORMAL_;// default base layers
|
||
default_layer_set (_DEF_BASE_MASK);
|
||
}
|
||
# endif
|
||
|
||
indicate_base (); // activate led change
|
||
}
|
||
break;
|
||
|
||
# if defined(BASE_NUMPAD__ALT_BASE)
|
||
|
||
case OTHER_BASE_GO: // Switching through the default/alternate BASE modes, and Descramble for that Dvorak compile
|
||
if (record->event.pressed) {
|
||
;
|
||
}else{ // key up
|
||
|
||
// Cycles through the modes
|
||
# ifdef DVORAK_DESCRAMBLE_HALF // version Dvorak+Dvorak-descramble has 3 modes
|
||
if (_NORMAL_ == alternate) {
|
||
alternate = _FULL_;// alternate layers
|
||
default_layer_set (_ALT_BASE_MASK);
|
||
} else if (_HALF_ == alternate) {
|
||
alternate = _NORMAL_;// normal layers
|
||
default_layer_set (_DEF_BASE_MASK);
|
||
}else{ // _FULL_ == alternate
|
||
alternate = _HALF_;// alternate layers, without 'descramble' recomputing Unicode
|
||
//default_layer_set (_ALT_BASE_MASK);
|
||
// it cycles, and this comes always after it was set _FULL_
|
||
}
|
||
# else // Only switching the BASE layers between alternate and default
|
||
|
||
if (_NORMAL_ == alternate) {
|
||
alternate = _FULL_;// alternate base layers
|
||
default_layer_set (_ALT_BASE_MASK);
|
||
}else{
|
||
alternate = _NORMAL_;// default base layers
|
||
default_layer_set (_DEF_BASE_MASK);
|
||
}
|
||
# endif
|
||
// make the switch to the other Base layer
|
||
if (alternate) { //
|
||
layer_move (_ALT_BASE);
|
||
}else{
|
||
layer_move (_DEF_BASE);
|
||
}
|
||
}
|
||
break;
|
||
# endif
|
||
|
||
// Switching to layers:
|
||
|
||
case CTO_BASE:
|
||
// User pressed upper/left button, while not on BASE layer: ‛escape’ from a layer to BASE layer.
|
||
// On BASE itself, that key is <Escape>.
|
||
if (record->event.pressed) { // key down
|
||
;
|
||
}
|
||
else { // key up
|
||
if (alternate) { // go to the alternate version (bit of a hack maybe, but all alternate
|
||
// ... modes are non-zero)
|
||
layer_move (_ALT_BASE);
|
||
}else{
|
||
layer_move (_DEF_BASE);
|
||
}
|
||
}
|
||
break;
|
||
|
||
case CTO_NUMS: // activates number-symbols layer
|
||
if (record->event.pressed) { // key down
|
||
;
|
||
}
|
||
else { // key up, so that upon key down the target layer isn't already activated, triggering that key on up
|
||
if (alternate) { // go to the alternate version
|
||
layer_move (_ALT_NSY);
|
||
}else{
|
||
layer_move (_DEF_NSY);
|
||
}
|
||
}
|
||
break;
|
||
|
||
case CTO_ACCE: // Unicode layer
|
||
if (record->event.pressed) { // key down
|
||
;
|
||
}
|
||
else { // key up
|
||
|
||
# ifndef REMOVE_ACC // This cuts out the whole _ACC layer.
|
||
layer_move (_ACC); // activates normal accented layer
|
||
# else
|
||
# ifdef _ACC_KEY_ALT_LAYER
|
||
layer_move (_ACC_KEY_ALT_LAYER); // Alternative layer user configuration
|
||
# endif
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case CTO_DRAW: // Unicode layer
|
||
if (record->event.pressed) { // key down
|
||
;
|
||
}
|
||
else { // key up
|
||
|
||
# ifndef REMOVE_DRA // This cuts out the whole _DRA layer.
|
||
layer_move (_DRA); // activates normal accented layer
|
||
# else
|
||
# ifdef _DRA_KEY_ALT_LAYER
|
||
layer_move (_DRA_KEY_ALT_LAYER); // Alternative layer user configuration
|
||
# endif
|
||
# endif
|
||
}
|
||
break;
|
||
|
||
// The below are a simulated LT(layer,kc), layer-tap.
|
||
// Double-tap-hold repeater functionality: not done.
|
||
// They switch what layer to use depending on 'alternate' variable
|
||
// Basically it starts the right layer on key down, goes back to base layer on key up,
|
||
// and throws in a keypress as well if tapped.
|
||
// It also integrates with DUO_HOLD, to reach the _BON layer.
|
||
|
||
# ifndef CHOLTAP_ACCE_NOP // When this key has been eviscerated, this macro becomes useless
|
||
case CHOLTAP_ACCE: // Works with DUO_HOLD macro to activate one of several layers.
|
||
if (record->event.pressed) { // key down
|
||
key_timer = timer_read ();
|
||
isolate_trigger = TRUE; // keep track of whether another key gets pressed.
|
||
|
||
duo_press_acc_bon ++; // This signals to the two DUO_HOLD keys, whether a move to _BON is desired.
|
||
|
||
if (duo_press_nsy_dra) { // One or more of the DUO_HOLD layer keys was already pressed; move to _BON
|
||
|
||
# ifndef REMOVE_BON // Removes this layer entirely, if set.
|
||
layer_move (_BON); // Bonus Unicode layer
|
||
# else
|
||
# ifdef _BON_KEY_ALT_LAYER
|
||
layer_move (_BON_KEY_ALT_LAYER); // Alternative layer user configuration
|
||
# endif
|
||
# endif
|
||
|
||
}else{ // pressed in isolation
|
||
|
||
# ifndef REMOVE_ACC // This cuts out the whole _ACC layer.
|
||
layer_move (_ACC); // Accented layer
|
||
# else
|
||
# ifdef _ACC_KEY_ALT_LAYER
|
||
layer_move (_ACC_KEY_ALT_LAYER); // Alternative layer user configuration
|
||
# endif
|
||
# endif
|
||
|
||
}
|
||
}else{ // key up
|
||
|
||
duo_press_acc_bon --;
|
||
|
||
if (1 == duo_press_nsy_dra) { // One DUO_HOLD layer keys is still pressed; move to numbers/symbols
|
||
|
||
if (_FULL_ == alternate) {
|
||
layer_move (_ALT_NSY);
|
||
}else{
|
||
layer_move (_DEF_NSY);
|
||
}
|
||
}else if (2 == duo_press_nsy_dra) { // Two of the DUO_HOLD layer keys are still pressed: move to _DRA
|
||
|
||
# ifndef REMOVE_DRA // This cuts out the whole _DRA layer.
|
||
layer_move (_DRA); // activates normal accented layer
|
||
# else
|
||
# ifdef _DRA_KEY_ALT_LAYER
|
||
layer_move (_DRA_KEY_ALT_LAYER); // Alternative layer user configuration
|
||
# endif
|
||
# endif
|
||
|
||
}else{
|
||
if (alternate) { // No _DEF_NSY layer keys remain pressed; Go back to base layer
|
||
layer_move (_ALT_BASE);
|
||
}else{
|
||
layer_move (_DEF_BASE);
|
||
}
|
||
}
|
||
|
||
// Pressed in isolation
|
||
if (isolate_trigger)
|
||
{
|
||
if (timer_elapsed (key_timer) <= TAPPING_TERM_HOLTAP) { // tapped
|
||
SEND_STRING (SS_TAP (X_DEL));
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
# endif // CHOLTAP_ACCE_NOP
|
||
|
||
case CHOLTAP_LAYR: //to _RAR on hold, otherwise a keycode
|
||
if (record->event.pressed) { // key down
|
||
key_timer = timer_read ();
|
||
isolate_trigger = TRUE; // keep track of whether another key gets pressed.
|
||
|
||
# ifdef BASE_RIGHT_ALT
|
||
SEND_STRING (SS_DOWN (X_RALT));
|
||
# else
|
||
layer_move (_RAR); // activates descrambled drawings layer
|
||
# endif
|
||
|
||
}else{ // key up
|
||
// Go back to base layer
|
||
if (speed_measure) speed_led (speed); // The _RAR layer overwrites the middle led,
|
||
//.. for use with alternate _HALF_ led colors (middle); thus needs to be set back to speed
|
||
// led color upon leaving.
|
||
|
||
# ifdef BASE_RIGHT_ALT
|
||
SEND_STRING (SS_UP (X_RALT));
|
||
# else
|
||
if (alternate) {
|
||
layer_move (_ALT_BASE);
|
||
}else{
|
||
layer_move (_DEF_BASE);
|
||
}
|
||
# endif
|
||
|
||
// Pressed in isolation
|
||
if (isolate_trigger)
|
||
{
|
||
if (timer_elapsed (key_timer) <= TAPPING_TERM_HOLTAP) { // tapped
|
||
SEND_STRING (SS_TAP (X_RIGHT));
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
# ifndef DUO_HOLD_BASIC
|
||
// This is the normal 'big' version, dealing with switching between _DEF_NSY/_ALT_NSY, _ACC, _DRA and _BON, in
|
||
// .. conjunction with the CHOLTAP_ACCE macro.
|
||
case DUO_HOLD: // The macro around the split space-bar. Both keys come to this macro.
|
||
if (record->event.pressed) { // key down
|
||
|
||
duo_press_nsy_dra ++; // simple way to keep track of how many are pressed
|
||
|
||
if (duo_press_acc_bon){ // Preceded by holding the _ACC/_BON layer switch key: move to _BON
|
||
|
||
# ifndef REMOVE_BON // Removes this layer entirely, if set.
|
||
layer_move (_BON); // Bonus Unicode layer
|
||
# else
|
||
# ifdef _BON_KEY_ALT_LAYER
|
||
layer_move (_BON_KEY_ALT_LAYER); // Alternative layer user configuration
|
||
# endif
|
||
# endif
|
||
|
||
}else if (1 == duo_press_nsy_dra) { // This is the first press of either of the DUO_HOLD keys on BASE
|
||
|
||
if (_NORMAL_ == alternate) {
|
||
layer_move (_DEF_NSY);
|
||
}else{
|
||
layer_move (_ALT_NSY);
|
||
}
|
||
}
|
||
else if (2 == duo_press_nsy_dra) { // both are pressed
|
||
|
||
# ifndef REMOVE_DRA // This cuts out the whole _DRA layer.
|
||
layer_move (_DRA); // activates normal accented layer
|
||
# else
|
||
# ifdef _DRA_KEY_ALT_LAYER
|
||
layer_move (_DRA_KEY_ALT_LAYER); // Alternative layer user configuration
|
||
# endif
|
||
# endif
|
||
}
|
||
|
||
}else{ // key up
|
||
|
||
duo_press_nsy_dra --;
|
||
|
||
if (1 == duo_press_nsy_dra) {
|
||
if (duo_press_acc_bon){ // Still holding the _ACC/_BON layer switch key, and one DUO_HOLD keys
|
||
|
||
# ifndef REMOVE_BON // Removes this layer entirely, if set.
|
||
layer_move (_BON); // Bonus Unicode layer
|
||
# else
|
||
# ifdef _BON_KEY_ALT_LAYER
|
||
layer_move (_BON_KEY_ALT_LAYER); // Alternative layer user configuration
|
||
# endif
|
||
# endif
|
||
|
||
}else{
|
||
if (_NORMAL_ == alternate) {
|
||
layer_move (_DEF_NSY);
|
||
}else{
|
||
layer_move (_ALT_NSY);
|
||
}
|
||
}
|
||
}
|
||
else { // Has to be zero.
|
||
if (duo_press_acc_bon){ // Still holding the _ACC/_BON layer switch key, but zero DUO_HOLD layer keys
|
||
|
||
# ifndef REMOVE_ACC // This cuts out the whole _ACC layer.
|
||
layer_move (_ACC); // Accented layer
|
||
# else
|
||
# ifdef _ACC_KEY_ALT_LAYER
|
||
layer_move (_ACC_KEY_ALT_LAYER); // Alternative layer user configuration
|
||
# endif
|
||
# endif
|
||
|
||
}else{
|
||
if (alternate) { // Back to letters
|
||
layer_move (_ALT_BASE);
|
||
}else{
|
||
layer_move (_DEF_BASE);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
# else
|
||
// This is the eviscerated version, compiled when all Unicode layers _ACC, _DRA, _BON are cut, and layer key
|
||
// .. combinations have not been assigned other uses.
|
||
case DUO_HOLD: // The macro for the keys around the split space-bar. Both keys come to this macro.
|
||
if (record->event.pressed) { // key down
|
||
|
||
duo_press_nsy_dra ++; // simple way to keep track of how many are pressed
|
||
|
||
if (0 != duo_press_nsy_dra) { // One or more of the DUO_HOLD keys is pressed
|
||
if (_NORMAL_ == alternate) {
|
||
layer_move (_DEF_NSY);
|
||
}else{
|
||
layer_move (_ALT_NSY);
|
||
}
|
||
}
|
||
}else{ // key up
|
||
|
||
duo_press_nsy_dra --;
|
||
|
||
if (0 == duo_press_nsy_dra) { // None of the DUO_HOLD keys remains pressed
|
||
if (alternate) { // Back to letters
|
||
layer_move (_ALT_BASE);
|
||
}else{
|
||
layer_move (_DEF_BASE);
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
# endif // DUO_HOLD_BASIC
|
||
|
||
// When held the key is shift. When tapped it is computed if the tap is short enough,
|
||
// and if no other key was pressed, in which case: right-shift-up is a toggle to the _FUN layer.
|
||
// The timing is meant to be able to undo an erroneous shift press just by holding longer,
|
||
// and the test if another key was pressed is to prevent an erroneous detection when typing
|
||
// very fast.
|
||
// The reason for this on shift is to isolate GUI, where _FUN was previously more easily
|
||
// located. No alternative tapping function with GUI because some systems do not treat GUI
|
||
// purely as a modifier it seems. Since it is a toggle anyway, _FUN can fit away from the thumb-hold row.
|
||
case CHOLTAP_RSHFT: // When tapped it toggles the _FUN layer, when held it is Shift
|
||
|
||
if (record->event.pressed) { // key down
|
||
|
||
SEND_STRING (SS_DOWN (X_RSFT));
|
||
shift_ison = 1; // shift depressed
|
||
|
||
key_timer = timer_read ();
|
||
isolate_trigger = TRUE; // keep track of whether another key gets pressed until key-up
|
||
|
||
}else{ // key up
|
||
|
||
SEND_STRING (SS_UP (X_RSFT));
|
||
shift_ison = 0; // shift released
|
||
|
||
if (isolate_trigger) { // no other key was hit since key down
|
||
|
||
|
||
// Held medium long: _PAD, long: _MOV.
|
||
// The reason to have a switch to _MOV on the left hand, is to be able to reach arrows on a toggle,
|
||
// all by the left hand, when the right hand is on the mouse.
|
||
if ((timer_elapsed (key_timer) <= 200)) { // tapped medium-long (milliseconds)
|
||
|
||
# ifndef SWITCH_RSHIFT_FUN_RAR // user config to reverse what this key its timing toggles to
|
||
|
||
layer_move (_FUN); // activates function layer as a toggle
|
||
|
||
} else { // held for longer
|
||
|
||
layer_move (_RAR);
|
||
|
||
# else
|
||
|
||
layer_move (_RAR); // activates function layer as a toggle
|
||
|
||
} else { // held for longer
|
||
|
||
layer_move (_FUN);
|
||
|
||
# endif
|
||
|
||
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
// The left-shift version of the above keycode. User can configure something (_PAD is default)
|
||
case CHOLTAP_LSHFT: // When tapped it toggles the _MOV layer, when held it is Shift
|
||
// _RAR was the first idea, but some of its keys are too dangerous regarding accidents.
|
||
if (record->event.pressed) { // key down
|
||
|
||
SEND_STRING (SS_DOWN (X_LSFT));
|
||
shift_ison = 1; // shift depressed
|
||
|
||
# ifndef REMOVE_PAD // The _PAD layer exists, we will use a timer …
|
||
|
||
key_timer = timer_read ();
|
||
|
||
# endif
|
||
|
||
|
||
// This variable is re-used, for speed and because using both shifts is useless,
|
||
// .. thus very rare, and also not a usage problem if it occured.
|
||
isolate_trigger = TRUE; // keep track of whether another key gets pressed.
|
||
|
||
}else{ // key up
|
||
|
||
SEND_STRING (SS_UP (X_LSFT));
|
||
shift_ison = 0; // shift released
|
||
|
||
if (isolate_trigger) { // no other key was hit since key down
|
||
|
||
# ifndef REMOVE_PAD // The _PAD layer exists, differentiate meaning by timer.
|
||
|
||
// Held medium long: _PAD, long: _MOV.
|
||
// The reason to have a switch to _MOV on the left hand, is to be able to reach arrows on a toggle,
|
||
// all by the left hand, when the right hand is on the mouse.
|
||
if ((timer_elapsed (key_timer) <= 200)) { // tapped medium-long (milliseconds)
|
||
|
||
# ifndef SWITCH_LSHIFT_PAD_MOV // user config to reverse what this key its timing toggles to
|
||
|
||
layer_move (_PAD);
|
||
|
||
} else { // held for longer
|
||
|
||
layer_move (_MOV);
|
||
|
||
# else
|
||
|
||
layer_move (_MOV);
|
||
|
||
} else { // held for longer
|
||
|
||
layer_move (_PAD);
|
||
|
||
# endif
|
||
|
||
}
|
||
|
||
# else // _PAD layer was eviscerated
|
||
|
||
layer_move (_MOV);
|
||
|
||
# endif
|
||
|
||
}
|
||
}
|
||
break;
|
||
|
||
case _FUN_STAY: // toggles if the f-keys return _FUN layer to BASE after one press
|
||
if (record->event.pressed) { // key down
|
||
|
||
if (_fun_stay == FALSE) {
|
||
_fun_stay = TRUE;
|
||
}else{
|
||
_fun_stay = FALSE;
|
||
}
|
||
indicate_fun_stay (); // leds
|
||
}
|
||
break;
|
||
|
||
# ifdef MOREKEY2_ARROW_CLUSTER
|
||
|
||
case _MOV_UP: // To be sure it activates on up key, and not already has triggered the _MOV layer during up-key.
|
||
if (record->event.pressed) { // key down
|
||
;
|
||
}else{ // key up
|
||
layer_move (_MOV);
|
||
}
|
||
break;
|
||
# endif
|
||
|
||
// These keys are so disruptive on an erroneous key press, that they are behind a shift lock.
|
||
// When used unshifted, they print a memory aid string: their name.
|
||
case C_KC_PWR:
|
||
if (record->event.pressed) { // key down
|
||
if (shift_ison) {
|
||
SEND_STRING (SS_TAP (X_PWR));
|
||
}else{
|
||
SEND_STRING ("<POWER>"); // Memory aid
|
||
}
|
||
}
|
||
break;
|
||
|
||
case C_KC_WAKE:
|
||
if (record->event.pressed) { // key down
|
||
if (shift_ison) {
|
||
SEND_STRING (SS_TAP (X_WAKE));
|
||
}else{
|
||
SEND_STRING ("<WAKE>"); // Memory aid
|
||
}
|
||
}
|
||
break;
|
||
|
||
case C_KC_SLEP:
|
||
if (record->event.pressed) { // key down
|
||
if (shift_ison) {
|
||
SEND_STRING (SS_TAP (X_SLEP));
|
||
}else{
|
||
SEND_STRING ("<SLEEP>"); // Memory aid
|
||
}
|
||
}
|
||
break;
|
||
|
||
case C_KC_PAUS:
|
||
if (record->event.pressed) { // key down
|
||
if (shift_ison) {
|
||
SEND_STRING (SS_TAP (X_PAUS));
|
||
}else{
|
||
SEND_STRING ("<PAUSE>"); // Memory aid
|
||
}
|
||
}
|
||
break;
|
||
|
||
case LEDS_ON: // Toggles left/right leds on or off
|
||
if (record->event.pressed) { // key down
|
||
if (leds_on == FALSE) {
|
||
leds_on = TRUE;
|
||
}else{
|
||
leds_on = FALSE;
|
||
}
|
||
}
|
||
break;
|
||
|
||
# ifdef LEDS_OFF_BASE_DEF // This messes with led effect on/off, so we need to track the state of this setting now.
|
||
case RGBTOG_: // Toggles middle led on or off
|
||
if (record->event.pressed) { // key down
|
||
if (led_middle_on == FALSE) {
|
||
led_middle_on = TRUE;
|
||
rgblight_enable_noeeprom ();
|
||
}else{
|
||
led_middle_on = FALSE;
|
||
rgblight_disable_noeeprom ();
|
||
}
|
||
}
|
||
break;
|
||
# endif
|
||
|
||
// Some keycodes treated specially for the two counting systems (speed, text size)
|
||
// Deletions:
|
||
case KC_BSPC: // non-counting speed
|
||
case KC_DEL: // non-counting speed
|
||
if (record->event.pressed) { // key down
|
||
if (sizecount_measure) sizecount_chars--; // minus count for text size (removed a character)
|
||
}
|
||
break;
|
||
|
||
// White space for counting words
|
||
case LT__MOV__KC_ENT: // We want to count the <enter> for word-counts, sadly this looses the key repetition of LT(…)
|
||
if (record->event.pressed) { // key down
|
||
|
||
key_timer = timer_read ();
|
||
layer_move (_MOV);
|
||
|
||
}else{ // key up
|
||
if (alternate) { // Back to letters
|
||
layer_move (_ALT_BASE);
|
||
}else{
|
||
layer_move (_DEF_BASE);
|
||
}
|
||
if (timer_elapsed (key_timer) <= TAPPING_TERM_HOLTAP) { // tapped
|
||
send_string ("\n");
|
||
if (sizecount_measure) {
|
||
sizecount_chars++;
|
||
|
||
if (sizecount_word) sizecount_blanks++; // count a word
|
||
sizecount_word = FALSE; // don't count immediately next blank as a word
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
// Word counting
|
||
case KC_SPC:
|
||
if (record->event.pressed) { // key down
|
||
if (sizecount_measure) {
|
||
sizecount_chars++;
|
||
|
||
if (sizecount_word) sizecount_blanks++; // count a word
|
||
sizecount_word = FALSE; // don't count immediately next blank as a word
|
||
}
|
||
}
|
||
break;
|
||
|
||
// These are excluded from counting for text size/speed, they prevent the “default“ in the case statement to execute.
|
||
|
||
case KC_LEFT:
|
||
case KC_UP:
|
||
case KC_DOWN:
|
||
case KC_RIGHT:
|
||
case KC_PGUP:
|
||
case KC_PGDN:
|
||
case KC_HOME:
|
||
case KC_END:
|
||
case LALT_T ( KC_LEFT ):
|
||
if (speed_measure) speed_countdown++; // Navigation could be integral to someone typing and correcting mistakes,
|
||
// but those keys don't add any text.
|
||
// Mouse movement is discounted in both speed and text size
|
||
case KC_WH_L:
|
||
case KC_WH_D:
|
||
case KC_WH_U:
|
||
case KC_WH_R:
|
||
case KC_MS_L:
|
||
case KC_MS_D:
|
||
case KC_MS_U:
|
||
case KC_MS_R:
|
||
case KC_BTN1:
|
||
case KC_BTN5:
|
||
case KC_BTN4:
|
||
case KC_BTN3:
|
||
case KC_BTN2:
|
||
break;
|
||
|
||
|
||
default: // If something else, it is a speed- and text measurement counting key
|
||
if (record->event.pressed) { // key down
|
||
if (speed_measure) speed_countdown--;
|
||
if (sizecount_measure) sizecount_chars++;
|
||
}
|
||
}
|
||
|
||
// If speed measuring is on, count keypresses
|
||
// The idea is to more/less follow common standard with typing speed counting: shift is not counted,
|
||
// layer-switching or its equivalent is neither. Arrows are not counted.
|
||
if (speed_measure) {
|
||
if (record->event.pressed) { // key down
|
||
|
||
if (0 >= speed_countdown) {
|
||
|
||
// key presses per second, but times ten for added precision of one digit
|
||
// This calculation quickly looses precision if not calculated with high enough numbers, but low enough to fit.
|
||
speed = (int) ( (SPEED_COUNTDOWN * 1000 ) / ((timer_read32 () - speed_counttime)/10) ); // counts time in ms
|
||
speed_led (speed); // updates led
|
||
|
||
// record for average
|
||
if (0 < (speed/10)) { // ignore 0 k/s batches, we assume the typer took a break
|
||
speed_batches++;
|
||
speed_add += speed;
|
||
}
|
||
|
||
// reset for next batch
|
||
speed_countdown = SPEED_COUNTDOWN; // reset
|
||
speed_counttime = timer_read32 ();
|
||
}
|
||
}
|
||
}
|
||
|
||
// For word-counting, ignore double blanks
|
||
if (sizecount_measure) {
|
||
if (record->event.pressed) {
|
||
bool within = TRUE; // When text size is maximized, this indicates we are not yet at that maximum.
|
||
|
||
# ifdef RGBLIGHT_ENABLE
|
||
unsigned short size_fraction = 0; // Used to compute led color as a fraction of a set maximum which is already typed.
|
||
# endif
|
||
|
||
// ignoring blanks wordcount
|
||
if ((keycode != KC_SPC)
|
||
&&
|
||
(keycode != KC_TAB) // This is ok, but a tab on BASE layer combo with Control, is not caught by this XXX (problem ignored, I never write Tab in a text worth counting)
|
||
&&
|
||
(keycode != LT__MOV__KC_ENT)
|
||
&&
|
||
(keycode != LT__MOV__KC_ENT)) {
|
||
|
||
sizecount_word = TRUE; // current key is not a blank, so we set this trigger for next key press
|
||
}
|
||
|
||
// computing maximum count effects: leds
|
||
if (0 != sizecount_max) {
|
||
|
||
if (SIZECOUNT_WORD == sizecount_max_type) {
|
||
if (sizecount_blanks > sizecount_max) within = FALSE;
|
||
}else{ // count chars
|
||
if (sizecount_chars > sizecount_max) within = FALSE;
|
||
}
|
||
|
||
// led colors
|
||
if (within) { // green to red middle led
|
||
|
||
# ifdef RGBLIGHT_ENABLE
|
||
if (SIZECOUNT_WORD == sizecount_max_type) {
|
||
size_fraction = (90 * sizecount_blanks) / sizecount_max;
|
||
}else{
|
||
size_fraction = (90 * sizecount_chars) / sizecount_max;
|
||
}
|
||
|
||
rgblight_sethsv_noeeprom (90 - size_fraction , 255, 255); // green to red, full saturation, full lit
|
||
# endif
|
||
|
||
}else{ // when at or over the limit: blink led red/white
|
||
if ((KC_BSPC != keycode)
|
||
&& (KC_DEL != keycode) // User already deleting, doubling is confusing
|
||
&& (CHOLTAP_LAYR != keycode)) { // This brings up the _RAR layer, to access the Count settings.
|
||
|
||
SEND_STRING (SS_TAP(X_BSPC)); // refuses to type further, the user is stopped from typing to make it obvious
|
||
|
||
}
|
||
|
||
# ifdef RGBLIGHT_ENABLE
|
||
if (sizecount_chars & 0x1) { // flip by every keypress
|
||
rgblight_sethsv_noeeprom (HSV_RED);
|
||
}else{
|
||
rgblight_sethsv_noeeprom (HSV_WHITE);
|
||
}
|
||
# endif
|
||
|
||
}
|
||
|
||
# ifdef RGBLIGHT_ENABLE
|
||
rgblight_set (); // only center led is altered, no need to go through isolate_rgblight_set()
|
||
# endif
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
// Simple macros, printing a character.
|
||
switch (keycode) {
|
||
|
||
/* _ACC layer definitions. */
|
||
|
||
// ------------------------- row 4
|
||
|
||
# ifndef REMOVE_ACC // This cuts out the whole _ACC layer.
|
||
case XP_ACC_AA: // because a
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CAL_ACU, CAU_ACU);// á Á
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_AB: // because o (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (COL_ACU, COU_ACU);// ó Ó
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_AC: // because e (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CEL_ACU, CEU_ACU);// é É
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_AD: // because u (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CUL_ACU, CUU_ACU);// ú Ú
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_AE: // because i (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CIL_ACU, CIU_ACU);// í Í
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_AF: // Because near Y
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CYL_ACU, CYU_ACU);// ý Ý
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_AG: // because near Y
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CIJL_BI, CIJU_BI);// ij IJ
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_AH: // because c (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CCL_CDL, CCU_CDL);// ç Ç
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_AI: // because ring-finger left is o (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (COL_STK, COU_STK);// ø Ø
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_AJ: // because pinky finger left is a
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CAL_RNG, CAU_RNG);// å Å
|
||
}
|
||
break;
|
||
|
||
// ------------------------- row 3
|
||
case XP_ACC_BA: // because a
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CAL_DIA, CAU_DIA);// ä Ä
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_BB: // because o (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (COL_DIA, COU_DIA);// ö Ö
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_BC: // because e (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CEL_DIA, CEU_DIA);// ë Ë
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_BD: // because u (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CUL_DIA, CUU_DIA);// ü Ü
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_BE: // because i
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CIL_DIA, CIU_DIA);// ï Ï
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_BF: // because near y
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CYL_DIA, CYU_DIA);// ÿ Ÿ
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_BG: // because vague logic about other hand having ae near on similar fingers
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (COEL_BI, COEU_BI);// œ Œ
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_BH: // because near œ, toward the side of a (pinky)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CAEL_BI, CAEU_BI);// æ Æ
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_BI: // because n
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CNL_TLD, CNU_TLD);// ñ Ñ
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_BJ: // because s
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output_single (CSL_SHP);// ß ß
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_BK: // because roughly the location on French keyboard
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output_single (C_MU_L);// μ
|
||
}
|
||
break;
|
||
|
||
// ------------------------- row 2
|
||
case XP_ACC_CA: // because a
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CAL_GRA, CAU_GRA);//à À
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_CB: // because o (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (COL_GRA, COU_GRA);// ò Ò
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_CC: // because e (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CEL_GRA, CEU_GRA);// è È
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_CD: // because u (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CUL_GRA, CUU_GRA);// ù Ù
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_CE: // because i (Dvorak)
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CIL_GRA, CIU_GRA);// ì Ì
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_CF: // because other hand same finger i
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CIL_CAR, CIU_CAR);// î Î
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_CG: // because other hand same finger u
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CUL_CAR, CUU_CAR);// û Û
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_CH: // because other hand same finger e
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CEL_CAR, CEU_CAR);// ê Ê
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_CI: // because other hand same finger o
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (COL_CAR, COU_CAR);// ô Ô
|
||
}
|
||
break;
|
||
|
||
case XP_ACC_CJ: // because other hand same finger a
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CAL_CAR, CAU_CAR);// â Â
|
||
}
|
||
break;
|
||
|
||
# endif // REMOVE_ACC // This cuts out the whole _ACC layer.
|
||
|
||
|
||
/* _DRA layer definitions. */
|
||
|
||
|
||
# ifndef REMOVE_DRA // This cuts out the whole _DRA layer
|
||
// ------------------------- row 4
|
||
case XP_DRA_AA: // because '", the opening „“ at the ‛open’ of the keyboard (left/up)
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_4THROW
|
||
unicode_hex2output (CS_DQUHR, CS_DQUL);// “ „
|
||
# else
|
||
unicode_hex2output_single (CS_DQUHR);// “
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_AB: // because to the right of opening “, ≤ on <
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_4THROW
|
||
unicode_hex2output (CS_DQUH, CS_ELTHAN);// ” ≤
|
||
# else
|
||
unicode_hex2output_single (CS_DQUH);// ”
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_AC: // because this is where the £ is on an English keyboard, on 'any' money symbols ¤; ≥ on >
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_4THROW
|
||
unicode_hex2output (CS_POUND, CS_EGTHAN);// £ ≥
|
||
# else
|
||
unicode_hex2output_single (CS_POUND);// £
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_AD: // because ∅ looks like ¢, and ¢ (cent) is on $ (money) ?
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_4THROW
|
||
unicode_hex2output (CS_NONE, CS_CENT);// ∅ ¢
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_AE: // because percentages %‰‱ and money ƒ are numerical ?
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_4THROW
|
||
unicode_hex2output (CS_PLMI, CS_LGULDEN);// ± ƒ
|
||
# else
|
||
unicode_hex2output_single (CS_PLMI);// ±
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_AF: // Because left of 🙂, on top of ★
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_4THROW
|
||
unicode_hex2output (CS_FLEUR, CS_HEART);// ❦ ♥
|
||
# else
|
||
unicode_hex2output_single (CS_HEART);// ♥
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_AG: // because 😊 ⍨
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_4THROW
|
||
unicode_hex2output (CS_SMIL, CS_SAD_);// 🙂 🙁
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_AH: // because «no reason», next to 😊 (emoticons)
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_4THROW
|
||
unicode_hex2output (CS_THUP, CS_THDN);// 👍 👎
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_AI: // because (
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_4THROW
|
||
unicode_hex2output (CS_OPSUP, CS_OPSUB);// ⁽ ₍
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_AJ: // because )
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_4THROW
|
||
unicode_hex2output (CS_CPSUP, CS_CPSUB);// ⁾ ₎
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
// ------------------------- row 3
|
||
case XP_DRA_BA: // because 1
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef SUB_SCRIPT_NUMS
|
||
unicode_hex2output (CN_1SUP, CN_1SUB);// ¹ ₁
|
||
# else
|
||
unicode_hex2output_single (CN_1SUP);// ¹
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_BB: // because 2
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef SUB_SCRIPT_NUMS
|
||
unicode_hex2output (CN_2SUP, CN_2SUB);// ² ₂
|
||
# else
|
||
unicode_hex2output_single (CN_2SUP);// ²
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_BC: // because 3
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef SUB_SCRIPT_NUMS
|
||
unicode_hex2output (CN_3SUP, CN_3SUB);// ³ ₃
|
||
# else
|
||
unicode_hex2output_single (CN_3SUP);// ³
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_BD: // because 4
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef SUB_SCRIPT_NUMS
|
||
unicode_hex2output (CN_4SUP, CN_4SUB);// ⁴ ₄
|
||
# else
|
||
unicode_hex2output_single (CN_4SUP);// ⁴
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_BE: // because 5
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef SUB_SCRIPT_NUMS
|
||
unicode_hex2output (CN_5SUP, CN_5SUB);// ⁵ ₅
|
||
# else
|
||
unicode_hex2output_single (CN_5SUP);// ⁵
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_BF: // because 6
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef SUB_SCRIPT_NUMS
|
||
unicode_hex2output (CN_6SUP, CN_6SUB);// ⁶ ₆
|
||
# else
|
||
unicode_hex2output_single (CN_6SUP);// ⁶
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_BG: // because 7
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef SUB_SCRIPT_NUMS
|
||
unicode_hex2output (CN_7SUP, CN_7SUB);// ⁷ ₇
|
||
# else
|
||
unicode_hex2output_single (CN_7SUP);// ⁷
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_BH: // because 8
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef SUB_SCRIPT_NUMS
|
||
unicode_hex2output (CN_8SUP, CN_8SUB);// ⁸ ₈
|
||
# else
|
||
unicode_hex2output_single (CN_8SUP);// ⁸
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_BI: // because 9
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef SUB_SCRIPT_NUMS
|
||
unicode_hex2output (CN_9SUP, CN_9SUB);// ⁹ ₉
|
||
# else
|
||
unicode_hex2output_single (CN_9SUP);// ⁹
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_BJ: // because 0
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef SUB_SCRIPT_NUMS
|
||
unicode_hex2output (CN_0SUP, CN_0SUB);// ⁰ ₀
|
||
# else
|
||
unicode_hex2output_single (CN_0SUP);// ⁰
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
// ------------------------- row 2
|
||
case XP_DRA_CA: // because [
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_2NDROW
|
||
unicode_hex2output (CS_OCBRA, CB_HHORI);// 「 ━
|
||
# else
|
||
unicode_hex2output_single (CB_HHORI);// ━
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_CB: // because ]
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_2NDROW
|
||
unicode_hex2output (CS_CCBRA, CB_LHORI);// 」 ─
|
||
# else
|
||
unicode_hex2output_single (CB_LHORI);// ─
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_CC: // because «no reason»
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_2NDROW
|
||
unicode_hex2output (CS_DEGREE, CS_CIRCLE);// ° 〇
|
||
# else
|
||
unicode_hex2output_single (CS_DEGREE);// °
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_CD: // because «no reason»
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_2NDROW
|
||
unicode_hex2output (CS_BULLET, CS_PARA);// • §
|
||
# else
|
||
unicode_hex2output_single (CS_BULLET);// •
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_CE: // because «no reason»
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_2NDROW
|
||
unicode_hex2output (CS_ELLIPS, CS_MIDDOT);// … ·
|
||
# else
|
||
unicode_hex2output_single (CS_ELLIPS);// …
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_CF: // because «no reason» (+ resembles ‛☒’ ?), ✗
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CS_CHECK_B, CS_CHECK_N);// ☐ ☒
|
||
}
|
||
break;
|
||
# endif
|
||
|
||
// This one must be included for _RAR layer
|
||
case XP_DRA_CG: // because next to ✗ ☐ ☒
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_2NDROW
|
||
unicode_hex2output (CS_CHECK_Y, CS_CHECK_H);// ☑ 🗹
|
||
# else
|
||
unicode_hex2output_single (CS_CHECK_Y);// ☑
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
# ifndef REMOVE_DRA // This cuts out the whole _DRA layer
|
||
case XP_DRA_CH: // because ?
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CQU_INV, CEX_INV);// ¿ ¡
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_CI: // because {, ┄ «no reason» (opposite side from ━)
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_2NDROW
|
||
unicode_hex2output (CS_ODABRA, CB_LHORID);// 《 ┄
|
||
# else
|
||
unicode_hex2output_single (CB_LHORID);// ┄
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_DRA_CJ: // because }, ┅ «no reason» (opposite side from ─)
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_DRA_2NDROW
|
||
unicode_hex2output (CS_CDABRA, CB_HHORID);// 》 ┅
|
||
# else
|
||
unicode_hex2output_single (CB_HHORID);// ┅
|
||
# endif
|
||
}
|
||
break;
|
||
# endif // REMOVE_DRA
|
||
|
||
|
||
/* _BON layer definitions. Due to running out of X(…), XP(…) space.*/
|
||
|
||
// ------------------------- row 4
|
||
# ifndef REMOVE_BON // Removes this layer entirely, if set.
|
||
case XP_BON_AA: // because of ' "
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_BON_4THROW
|
||
unicode_hex2output (CS_HQUOSB, CS_USER_DEFINED);// ‛ 🛠
|
||
# else
|
||
unicode_hex2output_single (CS_HQUOSB);// ‛
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_AB: // because of <, because "WASD" on _MOV
|
||
// 0x2019, single quotation mark: ’
|
||
// 0x2B06 arrow up: ⬆
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CS_HQUOSE, CS_ARR_UP);// ’ ⬆
|
||
}
|
||
break;
|
||
|
||
case XP_BON_AC: // because of >
|
||
// 0x00A4 any currency symbol: ¤
|
||
// 0x1F12F Copyleft: 🄯 (means free to copy, see also © for not free to copy.)
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_BON_4THROW
|
||
unicode_hex2output (CS_CURREN, CS_COPYL);// ¤ 🄯
|
||
# else
|
||
unicode_hex2output_single (CS_CURREN);// ¤
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_AD: // because $ and ¢ can be about money, and money is often added together
|
||
// because … no reason, left over space.
|
||
// 0x2211, summation: ∑
|
||
// 0xA9, copyright: ©
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_BON_4THROW
|
||
unicode_hex2output (CS_CUMMU, CS_COPY);// ∑ ©
|
||
# else
|
||
unicode_hex2output_single (CS_CUMMU);// ∑
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_AE: // because % for percent
|
||
// 0x2030,// promille: ‰
|
||
// 0x2031,// pro ten thousandth: ‱
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_BON_4THROW
|
||
unicode_hex2output (CS_PROM, CS_PROTT);// ‰ ‱
|
||
# else
|
||
unicode_hex2output_single (CS_PROM);// ‰
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_AF: // Because ♥ is a star, ❦ and stars can be used as bullet points
|
||
// 0x2605, star: ★
|
||
// 0x066D, star small: ٭
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_BON_4THROW
|
||
unicode_hex2output (CS_STARB, CS_STARL);// ★ ٭
|
||
# else
|
||
unicode_hex2output_single (CS_STARB);// ★
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_AG: // because of 🙂 🙁
|
||
// 0x1f60A,// <smile> ^^ 😊
|
||
// 0x2368,// "Squiggly" face <sad> ⍨
|
||
|
||
# ifdef FULL_BON_4THROW
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CS_SMILP, CS_SQUIG);// 😊 ⍨
|
||
}
|
||
# endif
|
||
|
||
break;
|
||
|
||
case XP_BON_AH: // because * also for multiply, because asterisk *
|
||
// 0x00D7,// multiply: ×
|
||
// 0x20F0 high asterisk: ⃰(this thing seems to behave a bit weird in vim(1) or terminal)
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_BON_4THROW
|
||
unicode_hex2output (CS_MULT, CS_ASTL);// × ⃰
|
||
# else
|
||
unicode_hex2output_single (CS_MULT);// ×
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_AI: // because ø sort of seems to divide something, and √ also does that, and close to ⁻⁺ (exponential)
|
||
// 0x221A,// square root: √
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef FULL_BON_4THROW
|
||
unicode_hex2output_single (CS_SQRT);// √
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_AJ: // because å points in the circle where this exponential minus goes, and it is right/"up" on the board
|
||
// because ⁻⁺ belong together
|
||
// 0x207B,// exponential minus sign: ⁻
|
||
// 0x207A,// exponential plus: ⁺
|
||
|
||
# ifdef FULL_BON_4THROW
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CS_EXPMIN, CS_EXPPLS);// ⁻ ⁺
|
||
}
|
||
# endif
|
||
|
||
break;
|
||
|
||
// ------------------------- row 3
|
||
case XP_BON_BA: // because 1, because "WASD" on _MOV (depending on setup)
|
||
// 0x2460, "1" : ①
|
||
// 0x2B05, arrow left: ⬅
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CN_1CIRC, CS_ARR_LE);// ① ⬅
|
||
}
|
||
break;
|
||
|
||
case XP_BON_BB: // because 2, because "WASD" on _MOV (depending)
|
||
// 0x2461, "2" : ②
|
||
// 0x2B07, arrow down: ⬇
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CN_2CIRC, CS_ARR_DN);// ② ⬇
|
||
}
|
||
break;
|
||
|
||
case XP_BON_BC: // because 3, because "WASD" on _MOV (depending)
|
||
// 0x2462, "3" : ③
|
||
// 0x27A1, arrow right: ➡
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CN_3CIRC, CS_ARR_RI);// ③ ➡
|
||
}
|
||
break;
|
||
|
||
case XP_BON_BD: // because 4, because ┏ forms a box with the other box drawings to the right/down
|
||
// 0x2463, "4" : ④
|
||
// 0x250F, box drawing heavy: ┏
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef BOX_DRAWINGS
|
||
unicode_hex2output (CN_4CIRC, CB_C_RIDN);// ④ ┏
|
||
# else
|
||
unicode_hex2output_single (CN_4CIRC);// ④
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_BE: // because 5, because ┓ forms a box
|
||
// 0x2513,box drawing heavy: ┓
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef BOX_DRAWINGS
|
||
unicode_hex2output (CN_5CIRC, CB_C_LEDN);// ⑤ ┓
|
||
# else
|
||
unicode_hex2output_single (CN_5CIRC);// ⑤
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_BF: // because 6, because ┃ continues box block
|
||
// 0x2465, "6" : ⑥
|
||
// 0x2503, box drawing heavy: ┃
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef BOX_DRAWINGS
|
||
unicode_hex2output (CN_6CIRC, CB_VE);// ⑥ ┃
|
||
# else
|
||
unicode_hex2output_single (CN_6CIRC);// ⑥
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_BG: // because 7, because ┇ continues box block
|
||
// 0x2466, "7" : ⑦
|
||
// 0x2507, dotted line verticle (heavy): ┇
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef BOX_DRAWINGS
|
||
unicode_hex2output (CN_7CIRC, CB_VE_DOT);// ⑦ ┇
|
||
# else
|
||
unicode_hex2output_single (CN_7CIRC);// ⑦
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_BH: // because 8, ╋ because 8 also has a crossing line in it
|
||
// 0x254B, crossing lines: ╋
|
||
// 0x2467, "8" : ⑨
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef BOX_DRAWINGS
|
||
unicode_hex2output (CN_8CIRC, CB_VE_BI);// ⑧ ╋
|
||
# else
|
||
unicode_hex2output_single (CN_8CIRC);// ⑧
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_BI: // because 9
|
||
// 0x2468, "9" : ⑨
|
||
// 0x2513,box drawing heavy: ┓
|
||
if (record->event.pressed) { // key down
|
||
|
||
unicode_hex2output_single (CN_9CIRC);// ⑨
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_BJ: // because 0, because a "0" can also be a symbol for infinity, round & round
|
||
// 0x24EA, "0" : ⓪
|
||
// 0x221E,// infinity:∞
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CN_0CIRC, CS_INFIN);// ⓪ ∞
|
||
}
|
||
break;
|
||
|
||
case XP_BON_BK: // because -, because ~
|
||
// 0x2014,// dash: — (might not render differently than a hyphen - in some applications. Dash is longer).
|
||
// 0x2248,// about equal to: ≈
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output (CS_DASH, CS_ABOUT);// — ≈
|
||
}
|
||
break;
|
||
|
||
// ------------------------- row 2
|
||
case XP_BON_CA: // because 1 above, because 「[
|
||
// 0x2039, opening single corner quotation: ‹
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output_single (CS_GUILSLE);// ‹
|
||
}
|
||
break;
|
||
|
||
case XP_BON_CB: // because 2 above, because 」]
|
||
// 0x203A, closing sinle corner quotation: ›
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output_single (CS_GUILSRI);// ›
|
||
}
|
||
break;
|
||
|
||
case XP_BON_CC: // because 3 above, because / (division)
|
||
// 0x00F7,// division: ÷
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output_single (CS_DIVI);// ÷
|
||
}
|
||
break;
|
||
|
||
case XP_BON_CD: // because 4 above, ┗ because forms box
|
||
// 0x261E, hand bullet point: ☞
|
||
// 0x2517, box drawing heavy: ┗
|
||
if (record->event.pressed) { // key down
|
||
# ifdef BOX_DRAWINGS
|
||
unicode_hex2output (CS_FINGER, CB_C_RIUP);// ☞ ┗
|
||
# else
|
||
unicode_hex2output_single (CS_FINGER);// ☞
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_CE: // because 5 above, because =, ┛ because forms box
|
||
// 0x2260,// inequal: ≠
|
||
// 0x251B, box drawing heavy: ┛
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef BOX_DRAWINGS
|
||
unicode_hex2output (CS_UNEQL, CB_C_LEUP);// ≠ ┛
|
||
# else
|
||
unicode_hex2output_single (CS_UNEQL);// ≠
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_CF: // because ☒ , ┣ box drawings block, some place
|
||
// 0x2717, cross mark: ✗ (complements ✓)
|
||
// 0x2523, box drawing: ┣
|
||
if (record->event.pressed) { // key down
|
||
|
||
# ifdef BOX_DRAWINGS
|
||
unicode_hex2output (CS_BOTCH, CB_VE_RI);// ✗ ┣
|
||
# else
|
||
unicode_hex2output_single (CS_BOTCH);// ✗
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_CG: // because 7 above, because ☑ 🗹 , ┫ complements with key to its left
|
||
// 0x2713, checkmark: ✓
|
||
// 0x252B, box drawing: ┫
|
||
|
||
if (record->event.pressed) { // key down
|
||
# ifdef BOX_DRAWINGS
|
||
unicode_hex2output (CS_CHECK, CB_VE_LE);// ✓ ┫
|
||
# else
|
||
unicode_hex2output_single (CS_CHECK);// ✓
|
||
# endif
|
||
|
||
}
|
||
break;
|
||
|
||
case XP_BON_CH: // because 8 above, because ¡ (inverted exclamation mark)
|
||
// 0x26A0,// alert: ⚠
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output_single (CS_ALERT);// ⚠
|
||
}
|
||
break;
|
||
|
||
case XP_BON_CI: // because 9 above, because 《
|
||
// 0xAB, French quotation opening: «
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output_single (CS_GUILLE);// «
|
||
}
|
||
break;
|
||
|
||
case XP_BON_CJ: // because 0 above, because 》
|
||
// 0xBB, French quotation closing: »
|
||
if (record->event.pressed) { // key down
|
||
unicode_hex2output_single (CS_GUILRI);// »
|
||
}
|
||
break;
|
||
|
||
# endif // REMOVE_BON
|
||
}
|
||
|
||
return true;
|
||
};
|