I've started[1] to do similar things on macOS using Hammerspoon[2]. So far I've set it up to let me:

1. Use shift when pasting something to simulate typing in the text instead, getting around websites that block pasting.

2. Use ";" as a hyper key. By holding it down and pressing another key, I can switch between specific programs without cycling. I can also use hjkl as arrow keys.

3. Automatically switch audio input and output devices according to my specified priority order. Because macOS would frequently get it wrong, including treating my monitor as a speaker for some reason (it doesn't have built-in speakers).

4. Make control act as escape when tapped. I use this in conjunction with remapping caps lock to control in macOS system preferences. I previously used Karabiner Elements for making caps lock work as escape when tapped and control when held, but I was able to uninstall Karabiner because Hammerspoon was sufficient.

5. Disable the insert key because I've never wanted its functionality, but I would sometimes hit it accidentally.

[1]: https://github.com/dguo/dotfiles/blob/master/programs/hammer...

[2]: https://www.hammerspoon.org/

Having used both Hammerspoon and AHK, the latter is somehow both terser and more ergonomic. I miss it dearly when I'm not on Windows.

And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really?

I've actually gone kind of crazy with this idea and made my left ctrl, shift and alt behave as fn+ctrl, fn+shift and fn+alt, so that e.g. left ctrl+h actually does ctrl+left. Then I made fn+[ = pgup, fn+] = pgdn, fn+; = home, fn+' = end and fn+\ = delete, with the same augmented fn+LHS modifiers.

Took me about a week for the muscle memory to catch up and allow me to correctly hit ctrl+L with the right hand when I want to go to the address bar, but now I'm ridiculously fast moving around in Excel without having to touch the arrow keys.

Only downside is I have a relatively problematic left wrist and this set up added to the already LHS stress to the already very imbalanced qwerty layout, so it forced me off mechanical keyboards to a low profile logitech right around the time COVID-19 hit.

If only Excel had vim bindings!!

> And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really?

Caps Lock is quite useful, because it's the perfect location for remapping the Ctrl- and ESC-Keys. Which is no surprise, as they originally where located there.

Under linux there is a nice tool for overloading keys, so they behave one way when pressed short, and another way when holded longer. With programmable keyboards you even have it OS-independant.

> Under linux there is a nice tool for overloading keys...

Name please (TIA)

Oh, right. I knew I forgot something.

I use https://github.com/alols/xcape for some while now. It's old, reliable and straight forward, just does it's job. Only downside is that it seems to be limted to X11. Not sure how well it will play with wayland.

There are now also some alternative tools, with more ability, which allow overloading just on the side. I have them on my list for a while now, but not done much yet with them.

- https://github.com/david-janssen/kmonad

- https://github.com/mooz/xkeysnail

- https://github.com/snyball/Hawck

Oh, and for rermapping capslock there are also options with X11. I use

   setxkbmap -option ctrl:nocaps
to map ctrl to capslock, then overload it with

    xcape -e "Control_L=Escape;"
to add ESC ontop.