Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is there anything that reaches the power of Karabiner Elements + Keyboard Maestro on Linux? (e.g., where application specific remapping is not experimental)


I never looked at karabiner's full functionality, but kanata is the closest thing to a linux version of QMK. It can kind of be used for hotkeys, but that's really not its purpose. Better to use a separate hotkey daemon.

Keyboard Maestro would be replaced by one or more completely different tools. There are programs that allow application-specific mapping. I've never seen the point of it, so I can't comment if any of them are any good. What are you looking to do? As someone who uses the keyboard for everything, my experience so far has been that macOS is much weaker at this.


> As someone who uses the keyboard for everything, my experience so far has been that macOS is much weaker at this.

Based on what I’ve seen, this isn’t true. macOS supports an amazing amount of keyboard mapping capability.

There’s a serious rabbit hole of macOS keyboard remapping; you’ve been warned: https://brettterpstra.com/topic/keybindings/


Keyboard mapping is fine on macOS (though most of those posts seem related to software or functionality I would never use). Keyboard-only experience is a lot more than keyboard mapping.

Consider window management, for example. If we're talking about using the keyboard for nearly everything, window management is one of the most fundamental parts of interacting with a computer. Linux has dozens of keyboard-based tiling window managers. You have only a few options on macOS, and they are all weak by comparison. Yabai is passable if you partially disable SIP so it can manage spaces, but it still has pretty limited functionality compared to herbstluftwm and bspwm (which is what it's mimicking) and feels hacky.

Similarly, cli tools are very popular on linux, and it is very easy to bind keys to them. Luckily a lot of tools work on both linux and mac, but this is not always the case. Replicating my global hotkeys has been an annoyance on macOS in some cases because of this. In linux, you have control of and multiple options for basically everything (e.g. bootloader, what you use for networking, what you use for notifications, etc.). In the case of notifications, on linux I can just bind a key to "dunstctl close-all" to close all notifications or "dunstctl history-pop" to show old notifications. My notification daemon is designed with scriptability in mind. If I want to have a similar keybinding on macOS I have to go through an arduous process of trying to find some up-to-date applescript snippet that actually works and isn't slow (couldn't find one that met either requirement) or learn to use some other automation tool. Unlike the WM case, I'm sure it's possible, it's just that macOS is just very clearly not designed with the use-case of keyboard for everything in mind. It can still support it very well, but with linux I can have it so that non-keyboard-friendly software just doesn't exist on my system. I don't need to workaround it.


Thank-you. Found a list of actual macOS keybindings, a cheat sheet of sorts:

https://brettterpstra.com/projects/keybindings/


Thanks, I'm aware of kanata, though haven't properly investigated it yet, the one area where it can beat Kara+ is if it implemented non-delayed based home row mods (though that's still an open issue; don't remember whether QMK supports it perfectly or also with delays, but a software solution to this would be much appreciated for all the laptops).

The low-level remapping and higher level app-specific and context-aware functionality is the Holy Grail that's still unachievable in any system, unfortunately, so that's why I specifically asked about the combo

> What are you looking to do

There are way too many interactions for me to list, it's anything from disabling all shortcuts when you play a game to quitting Insert text editor mode when you hold I, to making chord-based command menus with visual cues in apps that don't support anything like that, to inserting special symbols with helpful popups that only popup if you stumble and forget which key is next, to showing a palette with apps to launch with single keys without having to remember all those keys

You simply can't achieve it only via QMK-low-level approach


Kanata supports early tap-hold dispatch based on key overlap, which is all I need. There's an open issue for more advanced conditions: https://github.com/jtroo/kanata/issues/128

The maintainer has been very responsive in my experience and would probably add more advanced conditions if someone wanted them.

> There are way too many interactions for me to list

Sounds like mostly hackarounds for non-keyboard-friendly software. I generally prefer to use keyboard-friendly software (of which there is no shortage on linux) and just make application-specific keybindings directly in each application. Anything else is inevitably a hack. Window management, browsing, anything related to text or programming, etc. all have good keyboard-friendly options. I have to use some stuff like excel and teams for work, but I'll just use the mouse more in those cases. I don't spend a significant amount of time dealing with applications like that though, and e.g. for Teams I'd try set up a matrix bridge or just use warpd before trying anything else.

Teams no longer supports linux, but for other apps that have non-customizable key shortcuts, it's definitely possible hack around that and create your own in linux. E.g. When I used to use libreoffice regularly, I set up modal keybindings that sent the corresponding chords to libreoffice.

As long as I can use my editor to type anything non-trivial, I'm good. For example, you have generic software like sketchyvim on mac to essentially use vim in any input field. I don't think there's a linux equivalent that lets you essentially embed an editor like vim inside any input field, but you can use a generic keybinding to open one and then have the text sent back when you're done.

A lot of the examples you list don't seem to need any app-specific or context-aware functionality (e.g. your launcher example). I don't have enough of an idea of what you actually want to know if what's available on linux would support your use cases, but in addition to the numerous basic hotkey daemons there are programs like keyszer that support application-specific keybindings ootb or hawck which is scriptable in lua and supports conditional keybindings (allowing you to script per-application keybindings). You have some context available but only what is externally available, i.e. unless the program provides some way to interact with it like a cli utility or ipc socket, all you're going to be able to do is send input to it.


> Sounds like mostly hackarounds for non-keyboard-friendly software. I generally prefer to use keyboard-friendly software (of which there is no shortage on linux) and just make application-specific keybindings directly in each application.

No way, that's an almost non-existing class of apps. Which "keyboard-friendly software" supports the differentiation between tap and hold? Hold delays? Simultaneous keypresses? Arbitrary alpha key modifiers (hold T for Toolbar and tap 1,2,3 select different types of brushes in your image app)? Support for custom notifications? Knows left from right? Supports chords, not just combos, including single-key shortcuts? Basically, every app would need to add karabiner/katana as a library and slap app-specific contexts on top of that. Which apps do that???

> Anything else is inevitably a hack.

It's also the only way to make something great. There is no "native" OS/app development platform that matches that power, so it's very rare for an app to implement anything advanced on its own

> for other apps that have non-customizable key shortcuts

But it's not a binary, even apps that offer customizable key shortcuts, mostly offer underpowered versions nowhere close to what a keyboard remapper can offer.

> When I used to use libreoffice regularly, I set up modal keybindings that sent the corresponding chords to libreoffice.

But presumably you wouldn't want to send those shortcuts outside of Libreoffice, right? So you key remapper has to be app-aware

> sketchyvim on mac to essentially use vim in any input field.

This is great and I wish all OS had this basic functionality of allowing users to use their advanced text editing tools anywhere (there is also a more limited browser-only, but cross-platform extension GhostText)

> I don't think there's a linux equivalent that lets you essentially embed an editor like vim inside any input field, but you can use a generic keybinding to open one and then have the text sent back when you're done.

Sure, also you can always copy&paste, but that's friction, so not very suitable for smaller edits. Though maybe you can set a keybind that would instantly open a specially configured editor with a very small window size (basically, the size of a text field) without any extra visual stuff like gutter etc.?

> A lot of the examples you list don't seem to need any app-specific or context-aware functionality (e.g. your launcher example)

All of them do, e.g., app launcher requires the contexts of the app state. If the app is in the foreground, it will hide it, if it's in the background, it'll show it, if the app isn't not launched, it'll launch it.

> keyszer

that's only X11

> hawck which is scriptable in lua

thanks for tip, Autohotkey which it aims to replace is great (and lua is better, though also not a great scripting language), so this would be something like Hammerspoon on a Mac. That would still fall short of Keyboard Maestro with its GUI where you can much easier find he available actions and stich them together

> You have some context available but only what is externally available

That's a very common limitation unfortunately


> No way, that's an almost non-existing class of apps. Which "keyboard-friendly software" supports the differentiation between tap and hold? Hold delays? Simultaneous keypresses? Arbitrary alpha key modifiers (hold T for Toolbar and tap 1,2,3 select different types of brushes in your image app)? Support for custom notifications? Knows left from right? Supports chords, not just combos, including single-key shortcuts?

It would be cool, but I just don't see any of this as necessary. What I use supports single-key shortcuts, modality, and modifier shortcuts, and I wouldn't need anything else. Emacs and probably vim support arbitrary key combos and some more advanced functionality with timeouts, but I don't use those features. Even at the global level, I don't use tap-hold on alpha keys or arbitrary combos. It seems like these extra features are primarily useful as workarounds for having a bad keyboard. Normal modifiers are good enough for me. There are already plenty of actions available using just single keys and modifier keys, and modifier keys are comfortable on a good keyboard (even on my personal laptop I have 8 comfortable thumb keys). "hold T for Toolbar and tap 1,2,3" seems like a comparably painful/inefficient chord, and I'm not using software designed primarily with mouse interaction and things like toolbars in mind.

> But it's not a binary, even apps that offer customizable key shortcuts, mostly offer underpowered versions nowhere close to what a keyboard remapper can offer.

I'm definitely biased in that I'm a software engineer and am not working with graphical applications like photoshop. 95% of my time is spent using tools that are programmable and intended to be used primarily with a keyboard or at least have first-class support for it.

> there is also a more limited browser-only, but cross-platform extension GhostText

firenvim can also actually embed vim in browser input fields regardless of OS. Vim is really the only option still if you don't want an external window though.

> Though maybe you can set a keybind that would instantly open a specially configured editor

Right, there are things like emacs-everywhere that can be globally bound and will automatically handle the "syncing." Probably there are similar plugins for other editors but nothing universal I'm aware of.

> All of them do, e.g., app launcher requires the contexts of the app state. If the app is in the foreground, it will hide it, if it's in the background, it'll show it, if the app isn't not launched, it'll launch it.

I have global keybindings for all my most used applications that support toggle/dropdown functionality. I don't really use enough applications to need a launcher that does this, but you can at least implement this using external context only. It would be easy to script something like this on linux, but it would be X11-specific (e.g. tdrop + maybe rofi) or window manager-specific.

> That would still fall short of Keyboard Maestro with its GUI where you can much easier find he available actions and stich them together

Only if you're a fan of GUI configuration. I'd much rather have no GUI at all and just good documentation.

> It's also the only way to make something great. There is no "native" OS/app development platform that matches that power, so it's very rare for an app to implement anything advanced on its own

> > You have some context available but only what is externally available > That's a very common limitation unfortunately

It certainly would be nice if all software was integrated at the level where you could access and work with internal state. It's why I'm using Emacs for nearly everything, but then you're stuck with whatever limitations/flaws the system has, so there are tradeoffs. If you like having options, it's nice that linux has so many Desktop Environment choices and dozens of really good window managers. By comparison, if you like tiling window managers, macOS is not great. Yabai is passable but requires partially disabling SIP or else it can't even manage/switch spaces. On the other hand, a lot of hammerspoon functionality is missing on linux. Linux will probably never have any good generic automation tools. X11 at least has some more advanced, generic tools like xdotool, but this is currently impossible with Wayland, and definitely nothing supports both. Anything more advanced than input like window management is wm/compositor-specific currently on Wayland, so if anything, linux is going backwards wrt generic keyboard/automation tooling.


> I'm not using software designed primarily with mouse interaction and things like toolbars in mind. > I don't use those features. > Even at the global level, I don't use tap-hold on alpha keys or arbitrary combos.

But I do! Hence my question specifically about tools that match the power of the ones I use that allow the use of a broader class of apps than just emacs

> It seems like these extra features are primarily useful as workarounds for having a bad keyboard. Normal modifiers are good enough for me.

> "hold T for Toolbar and tap 1,2,3" seems like a comparably painful/inefficient chord, and

It's specifically chosen for the T mnemonic (thumb B for toolBar is also fine), which is easier to remember than the more convenient thumb mods, so works better for less frequently used functions

> There are already plenty of actions available using just single keys and modifier keys

Only if you significantly constraint app universe!

> probably vim support arbitrary key combos

Vim doesn't even support left vs right modifiers

> 95% of my time is spent using tools that are programmable and intended to be used primarily with a keyboard or at least have first-class support for it.

That's not first-class, that would be power+usability, and none offer that, you can get to power with a lot of effort and using other tools

> I have global keybindings for all my most used applications

Globals interfere with some uber-global fullscreen apps which you don't want to accidentally interrupt.

> Only if you're a fan of GUI configuration. I'd much rather have no GUI at all and just good documentation.

Or if value your time, for a lot of these functions it'd take much longer reading the docs/writing scripts

> If you like having options, it's nice that linux has so many Desktop Environment choices and dozens of really good window managers.

I like having good options, so having many subpar ones doesn't help. Hence the original question, it takes a lot of time having to review and find limitations of the various options, so thanks for the tips

> linux is going backwards wrt generic keyboard/automation tooling.

:(


You can also just Google “macos hyper key” and you’ll see how much is out there; this capability has been in macOS since the beginning.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: