DREYMAR'S BIG BAG of KEYBOARD TRICKS – ÞE OLDE PAGES
The Big Bag has moved! Go find the updated and more wonderfuller Big Bag at https://dreymar.colemak.org/ – Now Even Trickier!
Instead of separate platform topics, over there you can select a platform icon and get implementation info in handy context boxes.
Some less central content may not (yet) have been moved though, so if you're missing something make sure to look in both places before you despair.
The TMK/Controller content is not fully present on the new pages, so do read section [4] below for guidance. Just be aware that other content here may be outdated.
DREYMAR'S (USB++): DreymaR's Extensive Yet Modular ARSenal – for QUICKIE USB-2-USB & other TMK devices
There is a Big Bag of Keyboard Tricks Main Topic, in which I go into detail on what the different tricks are.
I also have topics focusing on different implementations of the Big Bag Of Keyboard Tricks:
• The Big Bag (PKL) for Windows (or go straight to the GitHub EPKL repository)
• The Big Bag (XKB) for Linux
• The Big Bag (TMK) for programmable "QUICKIE" devices – you are here!
• The Big Bag (Mac) for Karabinier by mkborregaard
DREYMAR'S BIG BAG OF TRICKS for QUICKIE USB-2-USB devices
WARNING - Some Assembly May Be Required (if you want a specific locale/ergo variant for instance)
[1] Character/Key Mapping Layers
[1.1] (My Colemak[eD] AltGr mappings)
[1.2] Extend layers using Caps Lock (and Tab) as switch modifier(s) for navigation/editing/browsing/etc from near the home position
[2] Ergonomic Key Remappings
[2.1] Angle/Wide ergo modifications to improve wrist angles, hand spacing and right pinky stretch/load effort
[2.2] Colemak-DH alias the Curl(DH) ergo mod (deprioritize middle columns without keys changing fingers)
[2.3] Symbol key mods for the adventurous (better apostrophe and/or hyphen positions; Work-In-Progress)
[2.4] Modifier modness for the adventurous (Sticky, One-shot etc; Work-In-Progress)
[3] Layout Variants
[3.1] Tarmak transitional Colemak layouts for learning Colemak in smaller steps if so desired
[3.2] (Locale and phonetic layout variants)
[3.3] Mirrored Colemak that allows one-handed typing without extra learning
[4] Download and Setup
[4.1] Download and Install
[4.2] Keymap Configuration
[4.3] Device Flashing
[4.4] Hardware Implementations
[–.–] Links/Done/Todo
This post explains what a QUICKIE USB-2-USB device is, and what I've managed to implement on Hasu's USB to USB keyboard converter using his TMK Keyboard Firmware Collection toolkit. If you're eager to get started before reading the details, you may jump directly to the Download and Install, Keymap Configuration and Device Flashing posts below.
GeekHack user yangdigi's comparison of USB-2-USB devices: Arduino Leonardo-type, Hasu's device and his own Pro Micro device.
Scale: Hasu's device is about 6 cm (2") long.
Look at those beauties, heh. I've decided to call this kind of device a QUICKIE (QWERTY USB In, Colemak Key Input Emulated)! ;-) More proper names are "USB-2-USB" or "USB to USB converter" device, as you may of course use it for non-Colemak layouts (and as my name is silly).
This non-OS-specific solution doesn't have the full power of layout installs, but it's very interesting. A USB-to-USB device that plugs between the keyboard and whatever you're connecting your keyboard to, provides an XKB/Win/Mac/what-have-you independent solution that can accommodate many of my tricks! For people having to deal with zealous IT security rules, this may be the only solution short of getting an expensive remappable keyboard. It could let you type Colemak+Extend to, say, a PlayStation or other device where you can't control the layout directly. It could let you pair code using Colemak+Extend while your mate uses QWERTY (poor thing!) on the same computer. And it could be fun to make one yourself if you're adventurous and DIY oriented!
The common solution is a microcontroller (such as Atmel's AtMega32 chips; Arduino Teensy 2+ or Pro Micro are good choices) with USB, coupled with a USB Host "shield" (separate little PCB) that lets you plug your keyboard into it. It'll mount itself as a HID keyboard, that is, a run-of-the-mill USB keyboard that almost any device accepts.
There are other options, too: You could have a PS/2-USB converter instead, or various keyboard controllers attached to or built into the keyboard itself! Most of these can use the same "Unimap" layout code, so if you're interested in one of those variants then check it out.
There are several possible ways of programming a USB-2-USB device. Essentially you have to:
1) Connect the device in Bootloader mode which means it can be programmed
2) Get some code and compile it for the device, or use a pre-compiled HEX file. There's even an online layout designer for a less techy option.
3) Flash the .hex file to the device's static memory
4) Reset the device (or just unplug and replug it) to reactivate application mode so it works
An advantage of my TMK-based implementation is that you can pick and choose most of the enhancements as modules:
• The AngleWide mods are keymap types so they work with any layout you choose, including QWERTY or Dvorak
• The Extend layers and switch keys are options that should work with nearly any existing layout
• The Curl(DH) mod for Colemak layouts uses a separate switch (together with CurlAngle keymaps)
• Mirrored Colemak and Tarmak (transitional Colemak) are separate layouts.
Freedom of choice through modularity is an ideal in the DreymaR world, as it is in Linux. :-)
[1] Character/Key Mapping Layers
[1.1] COLEMAK[eD] - EDITION DREYMAR
A USB-2-USB device remaps only key strokes, not character input events. So key mods like layout and ergo remappings are possible, but not mods that send glyphs. Your dead keys and AltGr mappings will work as they do without the device, and you may only move their keys around as they are.
Sorry, but AltGr/DeadKey glyph mappings such as the powerful Colemak[eD] below are for the most part up to the active layout on the machine you're typing to.
In all honesty though, it is possible to send Unicode with methods such as Windows' Alt+NumPad(####) defined for instance as TMK macros. But since it's platform dependent, memory consuming and clunky, I couldn't do this to create the full Colemak[eD]. Dead key tables and functions would've been even more byte-gobbling, so no.
However, I have made a user function that lets you define a few keys as four-level giving OS specific Unicode input using the RAlt key as AltGr for these keys only. I used this to get the Norwegian special letters åæø and their shifted counterparts (on the bracket and ISO LSGT keys) as in Colemak[eD], and it works fine for me. I even added the bullet and dagger glyphs (on the ISO \| key) for good measure. You can find various lists of alt codes to use, such as this one. Remember that you need to use "KC_P#" where # is the digit. For Mac or Unix you need to change the method, see the unimap_dreymar.c file and ask me if you need help.
Fig.: Colemak-CAW[eD], showing an ISO board with the Curl(DH)Angle and Wide ergonomic mods (see below).
[1.2] EXTEND LAYERS
This is My Favorite Mod next to Colemak itself! The ability to navigate and edit from the home position and its immediate surroundings is extremely powerful. It's like having part of the power of advanced editors like Vim ready in all situations. Plus a fully functional multimedia keyboard without sacrificing compactness. And much more.
My Extend Nav/Edit mappings. Green, navigation; blue, mousing; orange, multimedia; gray, system/misc.
My Extend NumPad mappings. Green, navigation; purple, NumPad; sepia, symbols; gray, system/misc.
The USB-2-USB implementation is almost the same as the Linux/XKB and Windows/PKL ones. Some advanced media key codes such as Brightness controls are missing for now (as their key codes aren't in TMK). How some of the advanced keys like MouseWheel Left/Right are interpreted is still up to the OS.
Here's the Extend1 and Extend2 layer charts from my TMK source file:
To use the Extend layers, define the CAPSBEHAVIOR constant to 1. This'll make CapsLock the Extend modifier. You may change it to another key by editing the active layout or keymap; see the Configuration post below.
There's a couple of EXT#BIT constants that determine how Extend2 is selected: If EXT2BIT is defined as MOD_BIT(KC_RSFT) for instance, holding Right Shift down while pressing the Extend key will activate Extend2. Holding down Extend alone will maintain that layer. The EXT3BIT and the combination of the two could select Extend3 and Extend4, but I haven't yet implemented these layers as I haven't yet decided on what to put in them. You could add your own if you want to – ask me how.
For the NumPad layer, remember that the NumLock state influences what you get. There's a NumLock key easily accessible in the layer.
NOTE: Superstacking Extend modifiers doesn't always work for me. Instead of Ctrl+Shift+Left, pressing Caps+S+T+N gave me ST key strokes. Oddly enough, it works with either Phys-Shift + Extend-Ctrl as well as Phys-RCtrl + Extend-Shift (Shift+Caps+T+N or RCtrl+Caps+S+N work) but not with physical LCtrl. This leads me to believe that the limitation is my keyboards' scan matrix, but it happened on all my boards. Other users didn't have this problem...?
[2] Ergonomic Key Remappings
[2.1] THE ANGLE/WIDE ERGONOMIC KEYBOARD MODEL MODS
These are ergonomic mods, moving some keys around to achieve straight wrists (the Angle mods), as well as better hand separation and right pinky load (the Wide mods). The Angle part is almost a no-brainer to me as it allows the left hand to keep a straight wrist without changing the fingering on ZXCV, and makes B easier to reach. Shai Coleman himself has given his "blessing" to this mod! The Wide mod is more optional, but it does put some load off the right-hand pinky, widen the arm distance (useful for small keyboards in particular, but nice regardless), and provide easier access to AltGr/Enter/Backspace/RShift.
The AngleWide(Slash) ergo mod for ISO keyboards.
I've implemented the ZXCVB_ 'Angle' shift for ISO keyboards both separately and as part of the AngleWide(Slash) mod that I use myself. For ANSI boards I've made an implementation of the 'Angle(Z)' shift (moving the Z key to the middle) and a Wide(Quote) mod as well as the combination of these. Also the 'A-Wing' mod to get the Angle and right pinky benefits without messing with the Z position (but at other costs).
The Angle(Z)Wide ergo mod for US/ANSI keyboards
Colemak-DH requires by default a special Angle(Wide) variant in which the V is kept in its original position so that only ZXC and B move; B then gets remapped to D by the mod itself. See below.
To use one of these, define the Unimap layout constant in my keymap (.c) file:
* Edit '_########' in the UNIMAPLAYOUT definiton below to choose ergonomic Curl/Angle/Wide keyboard mods:
* _UNMODDED - Standard Unimap format for all keyboard and converter types (w/o F13-24; this one is without ergo mods)
* _ISO__A__ (w/ Curl-DH: _ISO_CA__) - ISO/Int Angle (the simple lower left half-row shift)
* _ISO__AW_ (w/ Curl-DH: _ISO_CAW_) - ISO/Int Angle-Wide(/)
* _ISO_CAWS - ISO/Int Curl-Angle-Wide(/)-Sym (more accessible apostrophe and hyphen/minus)
* _ANS__A__ (w/ Curl-DH: _ANS_CA__) - ANSI/US Angle(Z)
* _ANS__AW_ (w/ Curl-DH: _ANS_CAW_) - ANSI/US Angle(Z)-Wide(')
* _ANSAWING ( Curl-DH: N/A ) - ANSI/US A-Wing
*
* Select a Curl(DH) or non-Curl ergo model, or plain unmodded Unimap. For Curl(DH), you also need to set CURLMOD.
* NOTE: These map layouts affect all layouts. So for instance the CAWS map will affect both Colemak and Extend.
The actual keymap types are defined in the header (.h) file as compiler macros and those are a bit harder to edit manually.
[2.2] COLEMAK-DH ALIAS THE CURL ERGO MOD
The Colemak-DH ergo mod makes the home "row" curl like a relaxed hand does instead of forcing it to a straight line as was commonly thought best some years ago. This is achieved by moving the common D and H from their debated "middle trench" positions to the more comfortable lower-row V/M positions, while preserving the key-to-finger mappings of vanilla Colemak. Since Oct 2020, standard Colemak-DH is the original DH mod a.k.a. DHm.
The Colemak Curl(DH)AngleWide, a.k.a. Colemak-CAW, ergo modded layout.
This mod depends on using a CurlAngle ergo mod which is easier on an "102/105-key" ISO keyboard but as seen above there are decent options for US/ANSI boards too.
To use Colemak-DH with my TMK files, there's a preprocessor switch named CURLMOD:
* The CURLMOD options for Colemak and Tarmak layouts are:
* 0: No Curl - vanilla Colemak/Tarmak
* 1: The 2017 Curl(DHk) ergo mod, bringing the D and H keys down to comfortable bottom-row positions (QWERTY C/M)
* 2: SteveP99's original Curl(DHm) ergo mod, bringing D/H down but M to the home row. DH standard since Oct 2020.
...
#define CURLMOD 1
This switch only affects Colemak layouts, including the four Tarmak layouts and Mirrored Colemak. Make sure you use a CurlAngle or CurlAngleWide keymap type such as UNIMAP_AWIZXCBV with it (optional for Tarmak1).
[2.3] PLAYING WITH THE SYMS (Work-In-Progress)
The fairly optional "Sym" symbol key mod hasn't been fully implemented in my TMK files. There's a model for CAWS-ISO that may serve as a template if you want another variant. But note that models affect Extend layers and other layouts too! So you may be better off just editing the layout definitions directly instead.
\ 7 8 9 0 =
[ j l u y ' -
] m n e i o ;
/ k h , . _____
The "Sym" symbol rotation mod together with the Curl-DH and AngleWide(ISO) mods is Colemak-CAWS.
[2.4] MODIFIER MODNESS (Work-In-Progress)
I've implemented Sticky Shift but not much else for TMK. See the repo files/docs. Moving modifiers around shouldn't be hard to do if you're interested.
[3] Layout Variants
[3.1] THE TARMAK TRANSITIONAL COLEMAK LAYOUTS
There's a main forum topic on this that you may want to read. Basically, I've added four Tarmak layouts that provide stepping stones from the standard (US) English QWERTY layout to the Colemak[eD] layout by moving only 3-4 keys per step. Each step brings at least one important key to the home row (notably, E-T-R-O-I) and only the uncommon J is misplaced in the process.
The 5-step Tarmak(ETROI) transitional Colemak layouts, spectrally color-coded from red (Tarmak1) to violet (Colemak).
The Tarmak progressions work modularly with the AngleWide ergo mods.
If you want to learn the brilliant Colemak-DH variant using a Tarmak progression, that's possible too! You just have to learn a CurlAngle mod before or with the 2nd Tarmak step which also gets tweaked a little so it moves B instead of G. The right-hand swaps (Hmk) should ideally be learnt in conjunction with Tarmak1-Curl because that moves K, but for SteveP's old variant I've deferred the HM swap to the last step. It could go wherever you like as it's separate, so feel free to edit the layout file if you desire.
* Tarmak2 - Transitional Colemak (ET)
* ,-----------------------------------------------------------.
* | | q| w| F| r| G| y| u| i| o| p| | | |
* |-----------------------------------------------------------|
* | | a| s| d| T| *J| h| N| E| l| ;| | |
* |-----------------------------------------------------------|
* | | z| x| c| v| b| K| m| | | | |
* `-----------------------------------------------------------'
* Tarmak2-Curl(DHk) - Transitional Colemak-Curl-DHk (ET)
* ,-----------------------------------------------------------.
* | | q| w| F| r| B| y| u| i| o| p| | | |
* |-----------------------------------------------------------|
* | | a| s| d| T| g| K| N| E| l| ;| | |
* |-----------------------------------------------------------|
* | | z| x| c| *J| v| _| M| H| | | | |
* `-----------------------------------------------------------'
[3.2] LOCALE AND PHONETIC VARIANTS
The QUICKIE only partially supports locales per se, as it only sends key strokes that are then re-coded by your computer's layout settings. My four-level Unicode function remedies this somewhat by allowing some keys to have their AltGr/RAlt states remapped to an OS dependent Unicode input method. So I can set a standard US QWERTY layout on my computer and still have, e.g., the locale ÆæØøÅå letters where I'm used to.
Before I made that function however, I used the locale layout installed on Windows. But I found that the default symbol key mappings are non-intuitive since they are quite different from the US ones which I'm used to now. So I've made a "hack" layout for myself that moves several symbol keys to where I feel they are better placed for me.
For instance, instead of a [=+] key as on US keyboards, the Norwegian locale has [+?], [0=] etc. I can't sort that out to get the symbol placements I'm used to as a Colemak[eD] typist unless I choose a US locale layout on the computer I'm on – but I still need the Norwegian ÆØÅ letters so that won't work! I had to settle for, e.g., moving the +? key to the US /? key position so at least the question mark is in the right place. Not perfect, but the best I could do.
Phonetic layouts for non-latin scripts require a layout with that script installed on the computer or whatever you're typing to. If you select a QWERTY phonetic layout for a script and have a USB-2-USB Colemak keymap active, your resulting layout will be Colemak phonetic. If, however, you want to swap some key positions (for Rulemak/Bulmak for instance), a suitable new keymap must be made and compiled.
[3.3] MIRRORED COLEMAK
Advanced typing with only one hand is possible given a modicum of familiarity with the mirroring method. In fact, this paragraph was written entirely using the left hand with the exception of the mirroring key itself, with hardly any training! The brain is inherently good at mirroring things.
Mirrored layouts are easily implementable for the USB-2-USB device. I've provided a mirrored Colemak that obeys the Curl mod setting. This will usually be your second layout (layer 1) on top of Colemak, so in my map file it's set by using ACTIVELAYOUT 5 (Colemak) and SECONDLAYOUT 6 (mirrored Colemak).
If you want a non-Colemak mirrored layout, you're on your own writing one. If you do, please post it below so others can benefit! I haven't yet
Mirrored Colemak (used as switch layout for one-handed typing)
* ,---. ,---------------. ,---------------. ,---------------.
* | \| |F12|F11|F10|F9 | |F8 |F7 |F6 |F5 | |F4 |F3 |F2 |F1 |
* `---' `---------------' `---------------' `---------------'
* ,-----------------------------------------------------------.
* |BSp| -| 0| 9| 8| 7| 6| 5| 4| 3| 2| 1| =| ` |
* |-----------------------------------------------------------|
* | Ent | ;| Y| U| L| J| G| P| F| W| Q|Esc|Cps| \ |
* |-----------------------------------------------------------|
* | ' | O| I| E| N| H| D| T| S| R| A| '| Enter |
* |-----------------------------------------------------------|
* | Shift | /| .| ,| M| K| B| V| C| X| Z| Shift |
* `-----------------------------------------------------------'
You'll want an easily accessible key (such as a thumb key) to switch between normal and mirrored typing. One suggestion is using LAlt for left-handed typing, and RAlt or RWin for right-handed typing. But you may instead use a foot switch set to any other key, or a "ghetto foot switch" made by stripping most keys off a keyboard and placing it on the floor, for instance. A more fancy but still cheap foot switch could be made by soldering the wires from a foot pedal switch (if you have something useable) to the contacts of a key on a cheap keyboard. By default, the layer switch key in my files is Pause/Break which could be cannibalized this way.
Then, you may choose whether the switch key should be a normal Shift-type (switch) or a Caps-type (toggle) modifier. See how I've defined the "FPau" Fn key in my file; it's used as my definition for the Pause key but you can copy that to any other key as well. The normal way would be to set FPau to Shift/switch-type with "ACTION_LAYER_MOMENTARY(1)" (the 'PAUSBEHAVIOR 2' setting), and then replace the desired key in your active (layer0) layout with FPau if you wish to move it. If you go with a toggle modifier, you need to make that key transparent (TRNS) on the mirrored layout, or provide a similar toggle somewhere else or you won't be able to get back!
Tip: Sticky Shift and Ctrl could be useful for one-handed typing! See the STICKYMODS setting.
[4] Download and Setup
[4.1] DOWNLOAD AND INSTALL
There's a separate Download and Install post below. It shows how to get and install my files, and also how to prepare the device in bootloader mode.
[4.2] KEYMAP CONFIGURATION
There's a separate Keymap Configuration post below. It shows how to get or tweak/make a HEX file that suits your layout needs.
[4.3] DEVICE FLASHING
There's a separate Device Flashing post below. It shows how to load a HEX file into your USB-2-USB device and get it ready for typing.
[4.4] HARDWARE IMPLEMENTATIONS
I won't cover all possibilities here. I use Hasu's converters myself and haven't got any experience with others, but the possibilities are many.
A Pro Micro (such as the one seen above by GeekHack user Yangdigi) may be cheapest, but it also seems to be the most techy option?
Colemak forum user Darkness made a device and his own code for it, see his "Arduino-based hardware keyboard remapper" topic for more info. Scroll down that page for pictures and a nice how-to sum-up post. He started off with an Arduino Leonardo like the one to the left in Yangdigi's image above; this can be a good development platform if you have one. But for a more useful implementation, he uses an Arduino Teensy 2.0 as seen below. Hasu has tried his TMK code on this device and it seems to be working fine.
Darkness's Teensy-based USB-2-USB Converter (see his topic)
I'm really hoping that the upcoming Teensy 3.5/3.6 can be used for TMK! These devices are fast, have a lot more Flash/RAM (512/192 kB for 3.5; 1024/256 kB for 3.6) and most importantly, come with a second USB intended for Host mode so it won't need a separate USB host! That may make it a cheap and powerful option; someone will hopefully test this soon.
The safest and easiest option may be to order the brilliant USB to USB Converter from GeekHack user Hasu, who has also developed the TMK software for converting keyboards to more awesome keyboards. (Hasu's device is also available from 1UpKeyboards which has a web shop but at a higher price from what I can see.) I've got a few of these beauties, and my code, instructions and .hex definition files below are based on Hasu's device although they may be used for other devices too (may need some geeky tweaking).
Hasu's USB to USB Converter for TMK Key mapping (original photo by Nick J Bair)
Oh look, Hasu has other converters and keyboard controllers too! Here's a PS/2-to-USB converter making my friend's vintage IBM Model M board awesome.
This topic won't show you any more about how to get your own QUICKIE USB-2-USB device. From my own experience I can heartily recommend Hasu's products, but find out what works for you. Best of luck, either way!
LINKS:
@GeekHack:
Hasu's USB to USB converter topic and Hasu's converter buying topic
Hasu's TMK topic (code basis for keyboard controllers/converters in general)
NJBair's review of Hasu's USB-2-USB converter, with a nice FLIP guide
YangDigi's Pro Micro DIY converter topic (some Teensy info too)
@GitHub:
Hasu's GitHub TMK repository, and its USB-2-USB section
Hasu's Build FAQ, Build README and keymap README
NJBair's repository including some build/flash info
Hasu's TMK Keyboard Wiki with much useful info
@TMK_site:
Hasu's Online TMK Keymap Editor for the USB to USB converter
@Colemak:
Darkness' Arduino-based hardware keyboard remapper topic
@QMK:
QMK (Quantum Mechanical Keyboard) is a TMK-fork-gone-solo that deserves honorable mention
The GitHub QMK repository (I don't use QMK myself, but it has a lot of documentation and more)
DONE:
• Now witness the typing power of this fully operational USB-2-USB device! Happy hacking, brave and adventurous souls! ;-)
• 2018-01: Added a user function that allows for input of Unicode glyphs not in the layout using the AltGr(RAlt) modifier.
• 2018-02: More advanced modifiers for Extend2+. Hold down, e.g., RShift then Caps (then release RShift) for Extend2. Can't use Alt keys (yet) on Win.
TODO:
• Extend modifiers don't always stack? Caps+S+T+N didn't produce Ctrl+Shift+Left but ST keystrokes for me once; others have had no such problems.
• Extend3–4? Would it be possible to implement some shortstrings at least? Memory limitations may preclude this for now.
• Use the ScrollLock LED to show whether the second layout is active?
My Unicomp SpaceSaver Buckling Spring (IBM Model M ISO type) keyboard with "American/Ninja" caps, splendidly sporting the Colemak-CAW layout.
*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***