Mapping Ctrl-hjkl to arrow keys on macOS

After mapping my Caps Lock key to work double duties as both Esc and Control I soon wondered how it would be like if I could have Control-hjkl act as arrow keys, full Vim style. Turns out it’s not that hard:

  1. Install Hammerspoon
  2. Open it’s config file and add the following setup:
local function pressFn(mods, key)
	if key == nil then
		key = mods
		mods = {}

	return function() hs.eventtap.keyStroke(mods, key, 1000) end

local function remap(mods, key, pressFn)
	hs.hotkey.bind(mods, key, pressFn, nil, pressFn)	

remap({'ctrl'}, 'h', pressFn('left'))
remap({'ctrl'}, 'j', pressFn('down'))
remap({'ctrl'}, 'k', pressFn('up'))
remap({'ctrl'}, 'l', pressFn('right'))

remap({'ctrl', 'shift'}, 'h', pressFn({'shift'}, 'left'))
remap({'ctrl', 'shift'}, 'j', pressFn({'shift'}, 'down'))
remap({'ctrl', 'shift'}, 'k', pressFn({'shift'}, 'up'))
remap({'ctrl', 'shift'}, 'l', pressFn({'shift'}, 'right'))

remap({'ctrl', 'cmd'}, 'h', pressFn({'cmd'}, 'left'))
remap({'ctrl', 'cmd'}, 'j', pressFn({'cmd'}, 'down'))
remap({'ctrl', 'cmd'}, 'k', pressFn({'cmd'}, 'up'))
remap({'ctrl', 'cmd'}, 'l', pressFn({'cmd'}, 'right'))

remap({'ctrl', 'alt'}, 'h', pressFn({'alt'}, 'left'))
remap({'ctrl', 'alt'}, 'j', pressFn({'alt'}, 'down'))
remap({'ctrl', 'alt'}, 'k', pressFn({'alt'}, 'up'))
remap({'ctrl', 'alt'}, 'l', pressFn({'alt'}, 'right'))

remap({'ctrl', 'shift', 'cmd'}, 'h', pressFn({'shift', 'cmd'}, 'left'))
remap({'ctrl', 'shift', 'cmd'}, 'j', pressFn({'shift', 'cmd'}, 'down'))
remap({'ctrl', 'shift', 'cmd'}, 'k', pressFn({'shift', 'cmd'}, 'up'))
remap({'ctrl', 'shift', 'cmd'}, 'l', pressFn({'shift', 'cmd'}, 'right'))

remap({'ctrl', 'shift', 'alt'}, 'h', pressFn({'shift', 'alt'}, 'left'))
remap({'ctrl', 'shift', 'alt'}, 'j', pressFn({'shift', 'alt'}, 'down'))
remap({'ctrl', 'shift', 'alt'}, 'k', pressFn({'shift', 'alt'}, 'up'))
remap({'ctrl', 'shift', 'alt'}, 'l', pressFn({'shift', 'alt'}, 'right'))

remap({'ctrl', 'cmd', 'alt'}, 'h', pressFn({'cmd', 'alt'}, 'left'))
remap({'ctrl', 'cmd', 'alt'}, 'j', pressFn({'cmd', 'alt'}, 'down'))
remap({'ctrl', 'cmd', 'alt'}, 'k', pressFn({'cmd', 'alt'}, 'up'))
remap({'ctrl', 'cmd', 'alt'}, 'l', pressFn({'cmd', 'alt'}, 'right'))

remap({'ctrl', 'cmd', 'alt', 'shift'}, 'h', pressFn({'cmd', 'alt', 'shift'}, 'left'))
remap({'ctrl', 'cmd', 'alt', 'shift'}, 'j', pressFn({'cmd', 'alt', 'shift'}, 'down'))
remap({'ctrl', 'cmd', 'alt', 'shift'}, 'k', pressFn({'cmd', 'alt', 'shift'}, 'up'))
remap({'ctrl', 'cmd', 'alt', 'shift'}, 'l', pressFn({'cmd', 'alt', 'shift'}, 'right'))

Source: kkamdooong/hammerspoon-control-hjkl-to-arrow

(I copied and pasted it here mainly for myself so I have it available the next time I need it.)


🌄 Noiry Morning

Noiry morning


Ducky One 2 Mini: How to Use Arrows with Modifiers

So during these last few days I’ve finally cracked how to use the arrow keys with modifiers on the 60% Ducky One 2 Mini keyboard.

As the keyboard does not have dedicated arrow keys, arrows can be simulated by hitting Fn+IJKL. This brings up the question “how do I do Alt+arrows, Ctrl+arrows, Ctrl+Shift+arrows etc”? I found myself a bit confused as it seemed that sometimes I was able to do what I wanted, but not everytime. Here’s the secret:

  1. Press and hold the modifier key(s), e.g. shift
  2. Press and hold Fn
  3. Press IJKL.

The “secret” being you need to hold the modifier first, then Fn, then arrows. If you want to do Ctrl+Shift+arrows, first hit Ctrl+Shift, then Fn, then arrows.

I have the 3rd DIP switch engaged on my keyboard, meaning the Caps Lock key acts as Fn (it’s great, you should do that too. The internet has way too much shouting going on as it is anyway). When I did Shift+arrows the Caps Lock engaged anyway (just hitting Shift+Caps Lock even though Caps Lock was mapped as Fn enabled Caps Lock) and it was driving me nuts! Turns out this behaviour was apparently (and correctly) regarded as a bug by Ducky and it’s fixed in the latest firmware (scroll to the bottom of the page where it says “Downloads”).


🔗 Love Letter To Clojure

For the first time in my career, as I’m nearing fifty years old, I’m finally able to write programs that do what I want them to do, and am able to build upon them for years without them collapsing like a house of cards, as has been my normal experience.

Gene Kim

There are quite many of these “Why I Love Clojure” -type blog posts, but this one is really great and thought-out. At least I bought it.


Keyboards, Layouts, QMK, Oh My!

So yesterday I was wondering whether or not I’m going to be fine with the Ducky One 2 Mini and it’s arrow key-less-ness.

Well, no. It sucks that it’s not quite possible (or requires crazy finger gymnastics) to be able to operate the arrow keys with Shift and Ctrl, which is something that’s not too uncommon when manipulating text.

So today I have another new keyboard, a loaner TADA68 from my old colleague Jaakko. And this blog post is the first test of this board.

The keyboard is kinda similar to the Ducky but at the same time miles apart;

  • This one is 65% instead of 60%, meaning there’s one extra column’s worth of keys, which in this case means the arrow keys (yes!) and Page Up & Down, Del and `.
  • TADA68 is fully programmable, meaning each and every key can be re-bound and fun & weird tricks can be employed. For example, the Caps Lock key could be mapped to act as Esc when pressed alone, but Control when pressed in a key combination.
  • Connects via mini USB (yuck).
  • This one is with ANSI layout, but apparently ISO layout is also available nowadays.
  • The TADA does not have RGB backlighting, just somewhat white LEDs.
  • The Ducky is slightly less tilted than the TADA.

I have to say I really, really enjoy the arrows as now it’s possible to switch chats in Telegram via Alt+Up/Down, select words with Ctrl+Shift+Arrows, minimize windows with Win+Down and do surprisingly many common little tasks with just one hand. I thought it’d be totally cool to every once a while push Fn (Caps Lock) with my pinky and IJKL for an arrow key, but alas, the need is far more common than I realized.

So this leads me thinking should I return the Ducky? If I did, what should I replace it with? TADA68 is great, but…

  • Both the keycaps and the chassis look (and to some extent feel) way cheaper than the Ducky.
  • Although ISO layout is available, Nordic keycaps out-of-the-box are not. Not that what it says on the keys matters that much, but still.
  • Did I mention it uses mini USB? It uses mini USB.
  • Also maybe it’s due to the fact that Jaakko’s keyboard is a year old, but the Ducky’s Cherry MX Browns feel way better (snappier) than the Gateron Browns on the TADA.
  • I do prefer the slightly smaller tilt on the Ducky.

So I’m 50-50 on this! Luckily I get to keep the TADA for a short while so I can get some hours on this to search my feelings.

Then again I just learned that Ducky has made a Nordic version of their Ducky One 2 SF, and that really would solve pretty much all of my problems – with the exception of not being totally programmable. But honestly, I’m not sure how much I’d really utilize such freedom.

Yet another option would be to forget Nordic and ISO layouts and learn to ANSI! That would open up the world of possibilities in both keyboards and keycaps…


Ducky One 2 Mini: Initial Impressions

I’ve had a so-called “mechanical keyboard” for a couple of years now. It’s a Corsair something-something with Cherry MX Red Silent switches. It’s my first Cherry keyboard, and as the switches are kinda hard to test before purchasing, I ended up ordering the Silent Reds purely based on the noise level they produce.

Turns out Cherry Reds are what are called “linear” switches. It means they don’t have the noticeable tactile bump when pressed. I kinda expected all mechanical keyboards to have that, and was a bit disappointed to find out my keyboard felt so mushy. Had I tested other colors before purchasing, I would’ve definitely chose differently.

However it was not the keyboard feel that lead me to investigating new keyboards, it was the size. The almost worthless numpad caused extra travel when moving my right hand from the keyboard to the mouse, which is ergonomically speaking not too nice, and I somewhat constantly kept hitting the edge of the keyboard with my mouse when gaming.

After a deep dive into a bit higher-end keyboard (the next logical step-up from Logitech & Corsair -type gaming keyboards were brands such as Ducky and Vortex), I ended up with the awfully named Ducky One 2 Mini. That was mainly because

  • It is a 60% keyboard, meaning no keypad, no arrows and no home/end/page up/page down -block.
  • It has RGB backlights.
  • It was available in the ISO layout with nordic keycaps.
  • It was available to order from a reputable store.

Now the keyboard has arrived and I’m writing this post mostly to try the keyboard out. Here are my initial impressions:

The good

  • Cherry MX Browns really feel a lot better than the mushy Silent Reds!
  • …yet they are not as offensively loud as I thought they’d be
  • The keyboard is tiny, there’s hardly any extra casing that expands outside of the keys themselves.
  • The keyboard can move the mouse cursor with Fn+WASD, but in addition to that, it can simulate the mouse wheel with Fn+R and Fn+F.
  • It connects with USB-C.

The bad

  • Don’t know yet, but it might well be that I’ll start missing the arrow keys hard. Fn+IJKL simulate them, but AFAIK it’s impossible to do, for example, Ctrl+Shift+arrows, which is a combination I use when editing text to select text a word at a time.
  • The cable that came with the keyboard is somewhat bad quality, might need to replace it with something nicer.
  • Even though the keyboard is somewhat programmable, it’s not 100% so… meaning I’m stuck with IJKL being to arrow keys and not being able to remap more Vim-style HJKL.

So overall that’s my first impressions, obviously with they keyboard being on my desk for a measily 24 hours the jury is still out. However I just noticed Ducky has released One 2 SF just a while ago and it looks really, really tempting already! It’s basically like the One 2 Mini but with arrow keys, Del, Page up & Page down and not that much bigger footprint. Now if only they released one with ISO layout…

Music Production

Setting up NI keyboard with Ableton Live


VST plug-in locations in Windows

Since I’m constantly confused with these, I’ll just jot these down for me to reference later on.

  • C:\Program Files\VSTPlugins – 64-bit VST2 plug-ins.
  • C:\Program Files\Common Files\VST3 – 64-bit VST3 plug-ins. (Live 10.1 and later).
  • C:\Program Files (x86)\VSTPlugins – 32-bit plug-ins.

Note: Live 10 is 64-bit only, so 32-bit plug-ins won’t appear in Live 10. Likewise 64-bit plug-ins won’t appear in 32-bit versions of Live.


My CS:GO autoexec.cfg

This here is mainly for my own purposes: The configuration I like when playing Counter-Strike: Global Offensive.

Continue reading “My CS:GO autoexec.cfg”

“Windows cannot be installed to this disk. The selected disk has an MBR partition table. On EFI system, Windows can only be installed to GPT disks.”

Here’s the case: I’m installing Windows 10, but even when formatting a hard drive in the installer Windows still won’t install, but complains about MBR, EFI, GPT, whatever. The issue lies within the MBR that is on the target disk, and it needs to be converted to GPT:

  1. Hit shift + F10 to open the command prompt in the Win 10 installer
  2. diskpart to start the Disk Partitioner application
  3. list disk to show all disks
  4. select disk # where # is the target disk, as indexed by list disk
  5. clean Warning: This empties the target disk!
  6. convert gpt to finally convert MBR to GPT.

After this the target disk should be empty and ready for Win 10 installation.