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

The main problem I had with living in a Gnome desktop environment, is with the keyboard. I'm not willing to abandon my use of Emacs control+meta sequences for cursor and editing movements everywhere in the GUI. On macOS, this works because the command (super/Win on Linux/Windows) key is used for common shortcuts and the control key is free for editing shortcuts.

I spent a day or so hacking around with kanata[0], which is a kernel level keyboard remapping tool, that lets you define keyboard mapping layers in a similar way you might with QMK firmware. When I press the 'super/win/cmd' it activates a layer which maps certain sequences to their control equivalents, so I can create tabs, close windows, copy and paste (and many more) like my macOS muscle memory wants to do. Other super key sequences (like Super-L for lock desktop or Super-Tab for window cycling) are unchanged. Furthermore, when I hit the control or meta/alt/option key, it activates a layer where Emacs editing keys are emulated using the Gnome equivalents. For example, C-a and C-e are mapped to home/end, etc.

The only problem is, this is not the behavior I want in terminals or in GNU/Emacs itself. So I installed a Gnome shell extension[1] that exports information about the active window state to a DBUS endpoint. That let me write a small python daemon (managed by a systemd user service) which wakes up whenever the active window changes. Based on this info, I send a message to the TCP server that kanata (also managed by a systemd user service) provides for remote control to switch to the appropriate layer.

After doing this, and tweaking my Gnome setup for another day or so, I am just as comfortable on my Linux machine as I was on my Mac. My main applications are Emacs, Firefox, Mattermost, Slack, ChatGPT, Discord, Kitty, and Steam. My Linux box was previously my Windows gaming box (don't get me started about frog boiling on Windows) and I'm amazed that I can play all my favorite titles (Manor Lords, Hell Let Loose, Foundation, Arma Reforager) on Linux with Proton.

[0]: https://github.com/jtroo/kanata

[1]: https://github.com/hseliger/window-calls-extended



Love this, and I'm in the same boat. Is your configuration of kanata public at all?

I know it's mostly muscle memory, but macOS shortcuts just seem sane and consistent and that has been one of the biggest frustrations when trying to switch. I found toshy[0] which does something similar - did you try that? The goal is purely macOS key remappings in Linux, so a much smaller scope than kanata.

[0]: https://toshy.app


I didn't try toshy, I had a bad experience when I tried kinto.sh a couple of years back, and I had a pretty clear idea of how I could get what I wanted out of a fully featured keyboard remapping tool under Linux. I initially started with Kmonad, but once I found Kanata, and realized that it had a TCP interface for programmatically changing layers, I quickly switched.

I have a Kinesis 360 keyboard, and my config[0] probably won't work for other keyboards, but it can give you a starting point for your own config.

[0]: https://gitlab.com/spudlyo/dotfiles/-/blob/master/kanata/.co...


I'm convinced a DE that figures this shit out out of the box will explode in popularity. Super for the OS and DE shortcuts. Ctrl for the Terminal and readline cursor movements. It can't be impossible to bake these in as defaults.




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

Search: