Tell HN: Have just discovered that I can use any key as Ctrl on my keyboard\
Sorry if this is silly but today I have discovered that my (pricey, I know) Ergodox-ez keyboard (but I assume any other "programmable" keyboard should work likewise) allows for any key to be programmed either for "press" or "hold".
And after more than a year using an uncomfortable configuration for my wrist (I use emacs a LOT), I have set 'j' to behave as CTRL when hold.
And then my mind has blown up.
No more weird thumb positions, or elongated pinkies.
I had done this with one of the large thumb keys for space when pressed, Meta when hold, but I had never imagined using 'j' (or, say 'f') for that.
97 comments
[ 190 ms ] story [ 4738 ms ] threadAlso, when using Emacs I often press and release the ctrl key without completing a control sequence, like when I'm thinking about scrolling but change my mind. I'd be splattering Js all through my source files.
Well, no, it would add zero milliseconds -- and zero nanoseconds -- of delay. The difference between key press and key release does not affect typing at all. You're not waiting to see what happens after you press T before you go on to pressing I (or whatever letter you're following it with).
Worth considering the time (and effort) saved from moving the hands to the modifier keys. It's nice being able to have the hands remain on the home row.
EDIT: rather, there's hardly any speed lost (if any); but there's a big amount of comfort gained from using home row mods.
> Also, when using Emacs I often press and release the ctrl key without completing a control sequence
The behaviour is customisable, but e.g. if you're holding the tap-hold key for longer than a 'tap', then it'd still register as a 'hold' rather than sending a 'tap'.
It may also be unclear what you intend if while holding 'j', you start pressing another key. The behaviour is customisable. https://docs.qmk.fm/#/tap_hold?id=tap-or-hold-decision-modes
> I hope you're not playing a game which uses j, because your inputs now have jitter.
Well, if you've got tap-hold on the keys "ASD", then games with WASD movement will be hard to play. :) -- I have a gaming layer without the tap-hold keys, separate from the normal typing layer.
https://github.com/manna-harbour/miryoku
Before QMK, I used Kmonad and Keyd for getting these advanced features on any keyboard.
https://github.com/kmonad/kmonad
https://github.com/rvaiya/keyd
It became so natural that normal keyboards became hard to use.
I am going to try this with my kinesys at work. The ergodox I have is for home.
Programmable keyboards offer so many improvements, it’s incredible.
Some of that can be done with xinput on Linux, but as far as I know the different-key-when-held functionality is not available there. [Edit: yewenjie’s comment mentions keyd which apparently does have that feature! https://news.ycombinator.com/item?id=31146572] While I waited for this one to be delivered (was a crowdfunding campaign) I used that to simulate some of its features and surprised myself when I found out that I stopped using the dedicated cursor keys even if all my keyboards had them.
I had never thought of using J for CTRL. You lose the ability to enter Line Feed (Return) with CTRL+J which I do use from time to time, but it sounds intriguing. I might try it out one of these days.
Why do you lose ctrl-j? There is another ctrl on the left side of the keyboard. Uh?
:-D Yes indeed, you are absolutely right. I had assumed that those keys would be used for something else but nothing stops you from having several CTRL keys.
One day a friends child was visiting and I put some games on for her. The little bastard somehow reprogrammed the 'r' key to empty macro, it took me weeks to find out what it was.
I remap caps-lock to ctrl on all my computers. Even my Chromebook allows this. Make Emacs much nicer to use.
The fact that it is expensive has nothing to do with it (I bought it for my rsi).
However, I think expensive keyboards (like the moonlander or the planck) are worth it for things like "symmetrical" and "thumb can use more keys than just the spacebar".
(1) https://www.autohotkey.com/
And, on Linux, this is combining `xdotool` with the native "shortcut" functionality in your desktop environment. ;)
[1] https://gitlab.com/interception/linux/plugins/caps2esc
[2] https://gitlab.com/interception/linux/tools
But the ergodox has such a nice programming interface that it makes the OS-level configuration pale in comparison.
[0] https://gist.github.com/ivyxjc/0ee9b1f37a5abdfbcd8f31db3c10f...
I have also used all the linux/mac tools for other keyboards but honestly, everything pales in comparison with ergodox’s configuration tool and with being able to program ordinary keys and see it work BANG like that. I just wanted to share this because honestly it blew up my mind.
My favorite is keyd, which allows the sort of hold vs press configuration spoken of.
Thank you for the write-up, you know you wrote that for just a handful of nerds with problems like this, happy to report you helped one!
I don't have a fancy keyboard so I have to do it in software.
My AutoHotkey script for Windows (modification of something I found online): https://gist.github.com/zanemayo/f4ff05a83630b70ea32116e761c...
My Karabiner Elements config for Mac OS: https://gist.github.com/zanemayo/04690de0a6f9783dad5a98aad5b...
CPU-based could be easier.
Also, fuck RMLVO, let live KcCGST.
Left Alt -> Ctrl
Meta ->Alt
Cpas Lock ->Esc
I'm for example using "modifier + ijkl" to send actual arrow key codes so I don't need to move to the arrows key cluster. It's not unlike gamers using wasd or esdf: ijkl mimics the arrows keys cluster. It just "makes sense". The modifier is always under my left thumb (I'm using a japanese keyboard, so the space bar is very narrow and I'm using the key at the left of the spacebar as the modifier for ijkl (and for other shortcuts). This is sweet because as actual arrows key code are sent, this works in every single program as if the arrow keys were actually pressed. I'm sure it can be even better: say by doing it at the keyboard controller level, bypassing the OS entirely but what I have works well enough for me.
Another trick: a modifier dedicated only to my window manager. Anything I need to do that is related to the WM gets done using a dedicated modifier. Never clashes with any single program. Bliss.
I do other cute things: OP mentioned using Emacs a lot... I configured things I use in Emacs all the time, like ivy / avy, to never require the pinkies (I removed the keys supposed to be pressed by pinkies from the list of available candidates).
Stuff like that. I spend countless hours on my keyboard setup and, to me, it's perfect. I did that years ago and since then I'm a happy camper.
> And then my mind has blown up.
Then I have one for you: you can use something else than ctrl to do ctrl-x in Emacs, using ctl-x-map. I'm using "key at the left of my tiny space bar + ." to do what ctrl-x does. No pinky and both hands are used (instead of doing left hand for ctrl and left hand for x).
> No more weird thumb positions, or elongated pinkies.
I don't really understand how you can get weird thumb positions on an ergodox though...
Buying a dygma raise after two failed ergodox attempts (meaning my split keyboard attempts are probably close to $1500aud) was absolutely worth it. It solved both issues, the former by supporting programmability. I can also move the keyboard to random computers without issues.
Please consider buying a programmable keyboard instead of X11 hacks, i say this as someone who put up with the problems for a decade.
I know but... I'm using a HHKB Pro JP since forever: Topre is my "end game" switch. Some modded their HHKB Pro 2 with a programmable controller but I'm not sure the mod is compatible with an HHKB Pro JP. Sadly the whole custom keyboard community is basically 99.9% cherry switches, 0.1% other switches and 0% Topre so no luck for me there.
There are physical layouts that I do appreciate but zero switch that I like (I tried everything, from Model M s to ALPS to every Cherry color under the sun) besides Topre.
> Buying a dygma raise
I cannot type on a split keyboard that has the '6' on the left part. I don't care if the travel is shorter for the left hand: I actually learned touch-typing from a secretary and she taught me to type the '6' with the right hand. Decades ago. There's no going back ; )
Conceptually it also scratches me the wrong way that left index gets to hit 4,5 and 6 while right index only gets to hit 7. It feels just wrong : )
I’m surprised the HHB line aren’t fully programmable, and a quick google hasnt found any home-rolled firmware mods. Always wondered about usb middleware that remaps keys dynamically, but I’m glad you’ve thought about it!
I am quite likely “holding it wrong” (TM) but I had to either extend my right hand too much to get to the ctrl key or was always oressing two keys at the same time.
It was probably a bad config but now… I’ve found it!
edit: fixed link
This essentially puts both Ctrl and Esc in a comfortable position on the home row, probably my favorite "ergo hack" ever.
[1] http://www.hammerspoon.org/
Do you have an example of this configuration somewhere you could share? Or are you using something existing, like https://github.com/jasonrudolph/ControlEscape.spoon ?
I previously used Karabiner for this and as far as I can tell, the behavior is the same.
The 'caps lock' and 'control' keys were swapped as compared to todays keyboards!
I've been thinking about observing my typing / window interaction patterns and optimizing them, but never could find the motivation. Sometimes I catch myself pixel-hunting some control in my IDE and wondering if there is a shortcut for it, but then again, is configuring/learning the shortcut worth the trouble?
Or maybe configurability benefits kick in after a threshold? I think there is a reality where I can be at least 5% productive by just streamlining my "head-computer" link, but I'm not sure what it's going to take to get there.