Comment by bsimpson

7 hours ago

Related but not:

I'm a lifelong Mac user who now has a KDE device courtesy of SteamOS. What are the best options for porting Mac default keybindings over to KDE?

I'm using SteamOS and Nix/Home Manager, so I have a preference for something that I can easily use in that environment (e.g. nothing that needs me to unlock the system partition or run as another user).

I tried asking Gemini to find where KDE stores its default keybindings, and came up short.

You can try to remap KDE keybindings but it won't affect Gnome applications, games, etc.

Personally, I found the most reliable thing to be a keyboard-level swap of Ctrl and the Cmd key. That way, whenever you're asked for Ctrl, which is all the time, you can always safely hit Cmd with no need for extra configuration. You can then remap various things in KDE Shortcuts to be more Mac like, like Cmd+Q, Cmd+Tab, Cmd+`, etc. (The only thing lacking is the Ctrl v. Cmd separation in a terminal, so I manually remapped all the Ctrl sequences in my terminal emulator to Win sequences, which matches my hardware Ctrl key. So, like on a Mac, Cmd+C works to copy, Ctrl+C is the escape code.)

This works for a Mac keyboard. For a Windows keyboard, you'd have to shuffle Alt -> Ctrl, Win -> Alt, and Ctrl -> Win. There are settings for this in xkb. (KDE surfaces these in its Keyboard settings panel.)

Keyboard layouts/shortcuts are a huge pain point with Linux. xkb is geriatric, and acts as such. Compose keys are flaky and inconsistent across applications. Virtually all Linux software is going to default to some idiosyncratic take on Windows shortcuts, often without much by way of customisability. (And those Windows shortcuts weren't very good to begin with.)

Given that you're already using Home Manager: Make sure to also take a look at plasma-manager! [1]

It extends HM's declarative config to KDE/Plasma's config files, which are harder to manage since they also contain volatile state like window geometry. For discovery, there is also a `plasma-manager` executable that prints out most (all?) active settings. In particular the keybindings are included in there.

(This doesn't directly answer your question, but maybe is informative regardless and/or helpful for finding related options)

[1] https://github.com/nix-community/plasma-manager

KDE has a setting to switch the cmd & command keys so that e.g. command+c copies instead of ctrl+c. This works in all KDE apps (it will not work if you install any Gnome/GTK app, though). I forgot the setting but its something in advanced and used to be called Emacs key binds, but now I think it just refers to the keys.

Anyways, beyond that, have a look at Kinto which tries to do everything in one box, but it is an additional software you have to run:

https://github.com/rbreaves/kinto

  • Thanks. I've also seen a derivative called Toshy. They both appear to be surprisingly invasive.

    I want something like Sublime Text's keybindings, where I can just iterate over all of KDE's system defaults and ask Gemini to convert them to their Mac equivalents. Can deal with individual applications separately, but since basically the only things I use are Chrome, Ghostty, Sublime, and the KDE shell, it seems like it ought to be pretty straightforward.

> What are the best options for porting Mac default keybindings over to KDE?

My recommendation is to get used to the KDE keybindings, and individual applications' keybindings. You'll never be able to fully replicate the macOS keybinding experience, so better get used to it. (Same when people use macOS, I recommend to get used to their keybindings and not try to replicate Linux/Windows)

There's a folder where KDE stores your user's settings. Shortcuts are in their own file...

For me it's `/home/$USER_NAME/.config/kglobalshortcutsrc`

  • Interesting! That might be the file I was looking for.

    I see 260 lines (some of which are whitespace). I wonder if that's all of the default keybindings, or if there are more hiding somewhere.