This repo is deprecated. I recommend using AutoKey and my autokeyconf configuration tool to get macOS keyboard shortcuts on Linux.
Perhaps you want to use Mac keyboard shortcuts in Linux. This isn't a simple matter of swapping the ctrl
and super
keys, because:
- The terminal uses
ctrl
to send signals to the foreground process—e.g. you wantctrl-C
to sendSIGINT
as usual. - Text navigation shortcuts are completely different on Linux—e.g. on Mac
cmd+shift+left
will select to the beginning of the line, whereas Linux usesshift+home
to accomplish the same thing.
This repo contains configuration for the key-remapping utility xkeysnail
, along with installation instructions for elementary OS (and probably other Ubuntu-based systems).
Inspired by kinto.sh, which I couldn't get to run on elementary OS due to python-vte
not being available in any repositories that were acceptable to apt
.
- Clone this repo.
- Install xkeysnail.
sudo apt install python3-pip sudo pip3 install xkeysnail
- Paste the following into
~/.config/autostart/xkeysnail.desktop
so xkeysnail starts on login. Be sure to replace/path/to/xkeysnail-macos-keymap/run
with the actual path.[Desktop Entry] Name=xkeysnail Comment=remap keyboard input Exec=sudo /path/to/xkeysnail-macos-keymap/run Type=Application
- Add a
sudoers
config to allow normal users to sudo therun
script without entering a password (replaceben
with your actual username and the example path with the actual one). E.g. on Linux Mint (and probably Ubuntu), you can do:sudo su root echo "ben ALL=NOPASSWD:/path/to/xkeysnail-macos-keymap/run" >/etc/sudoers.d/xkeysnail chmod 440 /etc/sudoers.d/xkeysnail
- Log out and log in.
This is horribly insecure and you shouldn't use it.
The issue is that 1) the run
script has to be sudo-able without
a password, and 2) xkeysnail
executes Python files which are probably owned by non-root users. The result is that anyone who can modify run
or
these Python files can execute arbitrary code as root when the user logs in.