Hacker News new | ask | show | jobs
by Fnoord 2502 days ago
Autokey (Python) gives you similar power as AutoHotKey on Windows and Karabiner Elements/Hammerspoon on macOS.

Problem is, that you might want Wayland support, as X is on the way out.

[1] https://github.com/autokey/autokey

3 comments

> Problem is, that you might want Wayland support, as X is on the way out.

I vaguely remember someone saying something similar about IPv6 once.

Last time I tried Karabiner Elements, it was quite buggy and brought down the kernel. Not a happy camper. Then Apple blessed us with allowing Escape-Caps remapping out of the box (guess that Touch Bar resulted in something useful...)

Did it improve? What do you remap?

FWIW, it does not crash (for) me.

I mainly use Hammerspoon as I prefer Lua over Json. I find Lua far easier to modify... to be fair, both Hammerspoon and Karabiner Elements have quite an impressive repository. If you want to do something it is probably already done.

My favourite is probably swapping of Cmd to Ctrl in VMs. That way you can use keybinds in Linux or Windows VM with the same muscle memory as in macOS. It may get confusing if you use Super a lot in Windows/Linux.

Another one is rebinding right Option (or "Alt") to Hyper. Most of the keybinds I use I got from this repo [1]. Though I did make quite some modifications I found it a good starting point (merging my own back). I remap Caps to Escape and Ctrl (latter if combined with another key) via Hammerspoon. You could also use Karabiner Elements though. Although I still use Caps mainly for Esc (muscle memory...)

On a Windows computer, I used AutoHotKey for some other stuff (gaming related QoL improvements). For some reason, Blizzard decided that in WoW you are not allowed to spam a key if you hold it. Which is flat out painful for the hands. I no longer play WoW regularly though. If I do, it is via Wine (on a Linux desktop). In Diablo 3 I made a keybind to swap gearsets. This was before Blizzard implemented the wardrobe.

[1] https://github.com/jasonrudolph/keyboard

I've started using it a few months ago, and it seems pretty stable.

I've got a fancier mapping for the caps lock key: when you hold it, it works like ctrl, and when you tap it it works like escape.

I've also got something similar for space: when I tap space, it works like space. When I hold space, I can tap additional characters. (So space works like a modifier, similar to ctrl or shift.) For example, space-x = delete, space-p = page up, space-j = cursor down.

I'm using the same keybind as you do.

The space one however, did not work well for me. It resulted too frequently in space not working at all. Supposedly it got matched as a combination with another key instead of a tap.

I recommend to apply a new rule, then test it out, then make another change. This way, you figure out which rule poses an issue.

There is one ruleset in Hammerspoon in the Github repo which I mentioned which -for me- makes it impossible to type cd. It always becomes c d

One of the three major reasons why I use Mac OS rather than Linux is the existence of Keyboard Maestro and TextExpander, which do tons of useful things and work everywhere. (if you care, the second reason is working system-wide clipboard and the third reason is Emacs keybindings in ALL dialog boxes and inputs).
I really like mac keybindings.

However, I really dislike how if I click what is traditionally the maximize button, it doesn't maximize both horizontally and vertically. I also really dislike how if I use the fullscreen mode and then use alt tab to switch windows it takes like 400ms to transition with some animation, and I can't disable it. I also really dislike how alt tab behaves, I want it to switch all windows not window classes. I also really dislike that I can't alt-click+drag to resize or move windows like I can in linux.

But most of all, I really dislike that there's no easy way to modify these behaviors without installing third party applications which at best can be described as dirty hacks.

They're the major reasons I use GNU/Linux over MacOS. Or would choose Windows over MacOS if Linux wasn't available.

> However, I really dislike how if I click what is traditionally the maximize button

That's no keybind though. The keybind for fullscreen is Control-Command-F as per [1]. On Firefox, I use Tree Tab Style and in order to hide the tabs, I need to also hide the top bar with the 3 top left window management symbols. Forced me to learn the shortcut (Cmd+H is another one I regularly use, to hide current application).

We should assume the user also is able to utilize multitouch gestures on TrackPad.

Fullscreen applications work very well with 3 finger swipe up which yields all windows and desktops, or 3 finger swipe down which allows further interaction to select the top window. Triple swipe left and right switch to current desktop minus or plus one. If you're going to run a VM, you will need these gestures.

Nothing in Linux land beats these gestures nor the Apple Magic Trackpads, IMO. I've been trying to get my Apple Magic TrackPad 2 to work on Linux. With multitouch. It works, but not as good as on macOS (tried with Libinput 1.13, not 1.14 yet).

You can use Cmd+` to swap between application windows. Nice boss key.

I found two third party apps which potentially fix your issue: Witch and HyperSwitch.

> and then use alt tab to switch windows it takes like 400ms to transition with some animation, and I can't disable it.

I didn't find a way to fix this. It does not bother me, as it is easy on the eyes, but I understand your concern. I also agree it is annoying that we need third party applications to fix these use cases but it does go with the minimalism theme. You could regard Gnome Tweaks as the same problem. And there's more third party applications I wouldn't want to live without such as Bartender.

> I also really dislike that I can't alt-click+drag to resize or move windows like I can in linux.

For resizing or dragging you can do this with the titlebar. I'd use one of these third-party applications like Spectacle or Amethyst to manage windows. I agree its a loss this isn't native. (I suppose Hyperdock provides this functionality?)

[1] https://support.apple.com/en-us/HT201236

If you're doomed to use Windows, you could use AutoHotKey (if allowed to).

It is FOSS, the scripting language is simple (though not Python, like AutoKey, there is an old Python port of it), and there is a large community with decent documentation and examples available.

AutoHotKey, unfortunately, does not work on Linux, at all. Not even with Wine.

I love that the keybinds on macOS are rather universal.