Yet another (simple) UHK configuration
Disclamer: my configuration is very simple compared to some of yours yall. I’m a heavy vimium / surfingkeys user, vim user, and linux tiling WM (sway) user, so I’m already loaded with all kinds of shortcuts, which is why I’m very hesitant to add more.
However, seeing at some of what yall are doing, and seeing as UHK has ton of layers, but I’m basically using only one (too small amount of keys on others to really call it a layer usage) - I thought I’d write up some of my use cases & my config for the general discussion.
Also current keycluster configuration is very new (set up yesterday) so maybe it’s a hit or maybe it’s a shit and I’ll go back to my old one.
Modules
I’ll start with modules and their configuration. I’m using keycluster and trackpoint modules.
Trackpoint
I find the trackpoint module godsend in that I don’t need to use a mouse for most of the things like clicking a link or selecting an element on a webpage or switching focus between different windows of an IDE.
However, I noticed that most of the time I’m using the trackping for scrolling web pages or code files: trackpoint does better job for me than any kind of trackball, keyboard (vim) navigation, or even a mouse. Mouse is too slow when I need to scroll big chunks of text, trackballs are not precise enough, and vim keys jump throughout the page in jagged chunks (not smooth). Trackpoint remedies all these points and is perfect for this use case for me, ability to quickly click on something next to it is an added bonus.
In order to use the scrolling function of trackpoint I have my second layer set up so I can press Mod key and then trackpoint works as a scroll.
Keycluster
Trackball is disabled: I don’t like it on keycluster, it just gets in a way.
Now, there’s one issue with keycluster: I didn’t find a good use for it yet.
Initially I binded it to key combinations that were
- opening an app launcher in OS (like Windows key does in Windows)
- opening search for code parts in the ide (fast search)
- refreshing the web page (F5)
However, just yesterday, after using UHK for over 3 years, I said: enough. All these actions are not happening often enough to warrant having a dedicated key for them, especially a key accessible right under my thumb.
Programmer keys
I’m a programmer, and using a standard dvorak layout. I considered trying a programmer dvorak layout but it didn’t really work, my brain didn’t want to easily rewire and I didn’t like the notion of having a custom keyboard layout not easily achievable by the UHK software, dependent on a custom keyboard layout file for every OS.
So I thought: maybe it’s a good idea to try using keycluster as a separate layer toggle where I could have some of my not easily reachable programmer keys more accessible.
For example, keys (){}[]
are a total pain in Dvorak (even more so than in Qwerty).
This is the new layer I came up with:
The layer is activated using a key closest to the space key (Fn2), and it provides easy index and middle finger access to these keys, without the need to stretch the pinky and hope that I will hit the right key correctly and not need to stretch my pinky to the backspace after to correct the mistake.
I have tried some programming typing practice to rewire my brain and so far it’s a pleasant experience, after I get used to it I might add more programmer keys to this layout (gonna do this with small portions).
Backspace
I always had one issue with having delete/backspace/enter on my keycluster: apart from the necessity to rewire my brain to use left hand instead of the right hand for these keys, I also feel like this will handicap me somewhat if I have the need to type on another keyboard. But now I decided to go through with it, based on this one thought: I’m already using Dvorak, if I’d need to use another keyboard (presumably on another machine) - I’m going to hunt and peck anyway. So I don’t really need the muscle memory to hit backspace with my pinky.
With these thoughts, I continued my reasoning: I like hitting Enter key with my right pinky, it’s not this far away and there is something satisfying in hitting it with my right pinky when I’m in a terminal window, so I wasn’t going to remap it. I’m not using delete key this often so I could spare remapping it, I didn’t need it on a dedicated key, it already existed on one of my layers. But backspace..
Backspace has always been my pain in the ass. It’s very distant, it’s uncertain (sometimes you could miss it and hit another key), and whole hand moves whenever you need to hit it. Plus, when you’re touch typing on speed and you make an error, every millisecond matters. So I decided to remap it to the keycluster module and see how it goes.
To the right of my programmer layer key there is a backspace key now. Also, I have mapped the backspace key to both trackpoint clicky keys for now, with the reasoning:
- I don’t use these keys as much as I use the keys on the keycluster, because when I’m moving my mouse with the trackpoint It’s inconvenient to click the mouse on the trackpoint as well, so I move the mouse on the trackpoint but I click the mouse using clicky keycluster keys.
- I was afraid remapping backspace from the right hand to the left is too much for my brain to handle, so I wanted the option to still hit backspace with my right hand while eliminating the need for my pinky to stretch.
- Having backspace both on the left and on the rigth side helps with ability to use any hand when I need to press backspace.
It’s not very convenient because clicky keys do not give the same feedback as mechanical keyboard key, and as you can see I mapped both (and not just one) because when there’s a need to quickly press (or in this case, click) the backspace - your finger might miss one and click another, or even both - because they are not keyboard keys and they are easy to miss, especially when you need to do it fast. However it works for the case when I would need to use backspace with my right hand.
The last key
I have mapped the top key of keycluster to my “launching apps” function for now, because it’s not very convenient to reach it anyway, you need to move your index finger across the whole palm (and turn your wrist as well) to press it, or to move your wrist completely, or you can try doing it with thumb but then you risk pressing other keys. So this key is going to be left for some more rarely executed functions for now. And even so, I feel like pressing “win+m” is faster and more convenient for me, than pressing this key, so I might just as well leave it unused.
The rest of the keyboard
I’m the advocate that you need to type right space after you typed left side letter and wise versa, that you need to use right shift with left side letter and wise versa etc, same with win key, control, etc, so:
- I’m using both Control keys as Control, both Shifts, both Win keys.
- I’m using both spaces as spaces as I’m the advocate that you need to type right space after you typed letter on the left half of the keyboard, and wise versa, in order to type fast.
- I have both Mod clicky keys (on the left and on the right) opening the same, Second layer - mostly function keys and some text manipulation
- Mod key on the left opens 3rd layer (mouse layer, but I don’t use mouse itself) - a bit more function keys
- Mod key on the right opens 4th layer (media and leds control)
- Mod key on keycluster opens 5th layer (programmer keys)
Most of the layers are more than 80% empty tho and I’m not even using most of the keys that are not (just figured it while writing this article).
CapsLock key
Now here’s the interesting part: since I’m using VIM - I use Escape quite a lot. And as any PC user I’m using Control quite a lot too. So, my Caps Lock key is remapped to be an Escape whenever you press it once, or Control whenever you press it together with some other key.
Default configuration didn’t work for me (there were some issues with it and I already do not remember what), so I wrote a macros for it which works perfectly:
holdKey iLC
ifInterrupted break
pressKey escape
Dvorak peculiarities
I’m using Dvorak layout - installed in the OS - this is why the keys you see on the screeshot are QWERTY-based. Keyboard needs to send QWERTY codes to OS so that OS is able to interpret these codes and map them to a Dvorak layout. This leads to an issue - whenever I want my keyboard to have some shortcut, for example - Ctrl+N, I need to actually set it up to send Ctrl+L. Because QWERTY L code is translated to N by the operating system. Sometimes it’s not very easy to map these codes. And if you want your macros to type “hello world” - good luck with that If anyone knows a better way - please let me know.
Because of this, I have 2 additional keymaps:
- Dvorak to Qwerty - this keymap allows me to switch keyboard into a mode when it acts like Qwerty keyboard, even in a system where Dvorak layout is installed. I need this keymap in order to play some games where WASD controls cannot be remapped (hello Blue Prince). I do not have a qwerty layout in my OS so I can’t switch to it using the OS.
- Qwerty to Dvorak - this keymap allows me to use my keyboard on any other machine where Qwerty is currently installed (coworker’s laptop or something)
It was pretty difficult to map these layouts so here are the screenshots if someone needs this (although, PUNCTUATION is NOT mapped on Dvorak to Qwerty yet).
The other layers (and function keys on the main layer too) - just duplicate the main keymap. All keymaps work identically feature-wise, apart from the layout, so I will just show the main one from now on.
Other modes
In order to easily differentiate between different modes, I’m highlighting just the center keys which are clearly visible when the keyboard halves are apart. I’m using completely blank key caps (without even see-through dots) so the only place where light can go is beneath / to the side of keycaps. This creates a nice effect of keyboard having a colored edge (also using Riser, which elevates the effect).
As you can see, on the Mod layer I have function keys mapped to the left side of the keyboard:
- It’s easier to use than having to grope for them with my right pinky.
- I use F5 key a LOT (both in browser, and in debugging software) so I mapped it under index finger.
- F12 is mapped right to the right of it, which is convenient when I need browser Dev tools.
- F9 F10 F11 are also all convenient to reach, these are used for step through control of debugging process in my IDE.
Alt+Tab key is mapped as in default UHK configuration, I got fond of it. I’ve done the same for other layers (so you can see you can use Alt+Tab like this from any layer). However, now that I moved back to Linux I don’t need this key anymore, but it was convenient on windows: not having to move my hand to do a physical Alt+Tab but keeping fingers on the home row.
If I need specifically a Control or an Escape key (in cases macros interferes with some programs) I can use them from this and the Fn layers conversely (check Fn layer picture too).
~
tilde key here can be used to turn on/off CapsLock key if I never need it.
The 4 lower left keys are a Ctrl+Z, Ctrl+X, Ctrl+C, Ctrl+V
keys in case I’m using a mouse and need to use them within one side of my keyboard. The issue with Dvorak is that C,V,Z keys are located on the right side of the keyboard so it’s not easy to use these shortcuts, this fixes this problem in case I need one-handed access to them. The same shortcuts are available within the Mouse layer too.
The keys are weird on the screenshot because these are the key codes I need to send to the OS in order for OS with installed Dvorak layout to interpret them as
Ctrl+Z...Ctrl+V
.
Right side of the keyboard with the Mod on can be used for:
- Arrow keys
- Delete key
- Insert key
Moving on to Mouse layer: I do not use it for the Mouse (I use solely trackpoint for that).
Mouse layer contains one important shortcut: SwitchDesktop. I use it to switch between two desktops, and it works both in Windows and Linux (because I mapped my desktop switching logic in Linux to resemble key shortcuts needed to switch desktops in Windos). Here’s how it works:
On the initial load, keyboard loads this $onInit
macros:
setVar desktop 0
setLedTxt 0 ""
setLedTxt 0 ""
removes the text from the led screen and turns , it’s irrelevant here.
However, setVar desktop 0
initializes a variable to track which desktop was used last time.
Then, I have this macros set up for the MouseMod+CapsLock
combination:
if ($desktop > 0) {
tapKey CG-leftArrow
setVar desktop 0
}
else {
tapKey CG-rightArrow
setVar desktop 1
}
which ultimately taps CG-leftArrow and CG-rightArrow alternating between them as you hit continuously MouseMod+CapsLock
.
You can check Fn
layer and see that it has a similar mapping for Fn+Enter
combination: so at any given moment of time if you want to switch desktop you can do this either with your left or your right hand independently of each other.
On the right side of my Mouse layer I have arrow motion keys again (but with Windows key pressed - this moves/arranges windows in Windows, now that I’m on Linux it’s irrelevant), delete key again if I want to avoid clicky sounds of Mod layer keys, and some more macroses.
First - s_pwd
and s_pwd2
. These are just entering my system password / another password, when I need them, and press Enter at the end. Super convenient. Yes I know it’s not secure, but I’m only using it for the password for OS and etc, not the secure web passwords for my bank accounts or something. Plus my UHK is pretty much always at my home.
Second - RDP Delay On / Off
. These macros turn off / on keyboard key send delay. This is sometimes needed when using RDP connection - some key combinations might not be correctly sent or interpreted by the remote machine. Here’s how the macros looks:
set keystrokeDelay 25
setLedTxt 0 "RDP"
set keystrokeDelay 0
setLedTxt 0 ""
So whenever I turn the delay on, I can visually see this on the LED screen (so I don’t forget to turn it off after the RDP session).
Moving on to Fn layer
One of the keys on the left was being used to quickly call Alt+F4, relevant for Windows, not so much anymore. Also F5 key and NitroType Start keys are just some action/macros keys for some web browsing automation, they just send key combinations in a row.
On the right - media controls, led controls (macroses control led brigthness or turn them off completely when I want darkness at night).
And at the bottom right - switching between keymaps (Main, Dvorak to Qwerty, or Qwerty to Dvorak).
That’s it. Now we reached the last layer - Programmer keys (Fn2)
This is the layer I created yesterday and is triggered from my keycluster module. I’m going to try to rewire my brain into using it and hopefully it will be worth it in the end.
It contains the following keys: {} [] ()
so I don’t need to stretch my pinky and try to peck for them in the top right corner of my keyboard (highlighting it on screenshot cause it’s not clear because of wrong keycodes displayed due to dvorak).
Finishing touches
Additionally, other layouts (QtD, DtQ) also have perpetual coloring of the edge of UHK so I know I’m on them until I exit them:
And furthermore, in order to still know which keymap it is even when I’m currently on a different mod layer - I’m coloring only part of the edge when I’m on a different layer, leaving one row of keys perpetually colored to the color of the current keymap:
^ Dvorak on Qwerty keymap (RED), Mouse layer (BLUE)