Step 1: Do the basic layout configuration
sudo apt install keyboard-configuration sudo dpkg-reconfigure keyboard-configuration
Pick
MacBook/MacBook Pro
Select your language layout, then hit enter for the following options, or select something other than the default if needed.
Step 2: Make the cmd button work, as it would in MacOS
sudo nano ~/.Xmodmap
Paste this code:
clear control clear mod4keycode 105 = keycode 206 =
keycode 133 = Control_L NoSymbol Control_L keycode 134 = Control_R NoSymbol Control_R keycode 37 = Super_L NoSymbol Super_L
add control = Control_L add control = Control_R add mod4 = Super_L
Save and close the editor with
ctrl + o enter ctrl + x
Then run the file to test it:
xmodmap ~/.Xmodmap
And if it works for you, add it to the system startup:
sudo nano /etc/init.d/custom-startup.sh
Add this code:
#!/bin/bash xmodmap ~/.Xmodmap
Then save and close the editor. Run:
sudo chmod +x /etc/init.d/custom-startup.sh
Then add it to cron:
crontab -e
Add:
@reboot /etc/init.d/custom-startup.sh
Save and exit, optionally test:
crontab -l
Restart the machine, and see if it the cmd key still works as desired!
Step 3 would be to make the @ button work, but this is still work in progress.