A Xkeysnail config that emulates macOS styled keyboard controls/shortcuts in Linux and X11.
-
Install Xkeysnail using your package manager or following Xkeysnail installation instructions.
-
Clone or download the provided config file to a location of your preference.
-
Edit the config file and replace
Your-terminal-app-here
with the window class of your terminal application.(To get the window class name, run
xprop WM_CLASS
and click on the window of the terminal application) -
Create a systemd service for xkeysnail to run automatically on the background:
cd /etc/systemd/system && sudo nano xkeysnail.service
-
Insert the following code to the service config and edit the path to the provided config file:
[Unit] Description=xkeysnail [Service] Type=simple KillMode=process ExecStart=/usr/bin/sudo /usr/bin/xkeysnail --quiet --watch /path/to/your/config-macos.py ExecStop=/usr/bin/sudo /usr/bin/killall xkeysnail Restart=on-failure RestartSec=3 Environment=DISPLAY=:0 [Install] WantedBy=graphical.target
-
Enable the xkeysnail service:
sudo systemctl enable xkeysnail
-
Start the xkeysnail service:
sudo systemctl start xkeysnail
-
To check if the xkeysnail service is running properly, run:
sudo systemctl status xkeysnail
-
If you encounter errors like
Xlib.error.DisplayConnectionError: Can't connect to display ":0.0": b'No protocol specified\n'
, make sure you havexhost
package installed and try:sudo xhost + && sudo systemctl restart xkeysnail
- Command key input in terminals is troublesome, since macOS uses ctrl for all terminal operations. While the provided scripts provide a workaround for this, you won't be able to use these in built-in terminals (i.e. VS Code).