A macOS like keyboard remap for Linux with GNOME shell (Ubuntu, Fedora)
To begin with I’ll tell you I’m not a big fan of keyboard remapping. Before you start think twice if you really want to do so. Sometimes it is easier to get along with the default keyboard layout provided by the system. Otherwise this thing can go pretty far down the road :-)
The struggle becomes real if you are taking advantage of a number of computers around with different systems installed on a daily basis. Or maybe you have a virtual guest machine with another system. A constant switching back and fourth between macOS, Linux (and Windows sometimes) made me look into the remapping issue.
In this article I want to demonstrate the way I remap the keyboard on GNOME based Linux distribution (like Ubuntu or Fedora) in a way to mimic the macOS behaviour. At the moment only X.Org display server is supported. To my understanding Wayland is not mature enough to support the keyboard remapping functionality.
Here is the list of scenarios I’d like to have working:
- Have left
control
working in Terminal to be able to kill processes withcontrol+c
, use default combinations for Nano editor etc. - Use left
command
to click select items in Nautilus and have all generic key combinations working across applications:command+s
to save,command+b
for bold text,command+n
to create a new file and yada yada. - On macOS I often launch apps with Spotlight. So having
command+space
to show applications screen on Ubuntu was a must have for me. There is one trick here. By default, Eclipse IDE usescontrol+space
to display assistant. So we need to differentiate betweencommand
andcontrol
keypress. - Next thing we want to imitate the
home
andend
keys functionality with macOScommand+left
andcommand+right
combinations; not to mention theshift
modifier that adds selection. - Its nice to have some Finder key combinations in Nautilus:
command+up
orcommand+down
to navigat`e in the file system,command+shift+.
to show hidden files and so on. - Last but not least, I’d love to have some neat macOS features like switch windows of the same application with
command+'
, launch the overview and show the applications list, taking screenshots etc…
How to Install the Keybindings
Please refer to my GitHub repository at https://github.com/petrstepanov/gnome-macos-remap for installation instructions. It’s very straightforward: you check out the repository and launch the install.sh
script.
Spotlight alternative
I recommend installing the Ulauncher application launcher. It provides similar functionality to macOS’s Spotlight search. It is possible to assign the command+<space>
keybinding to fire up the Ulauncher — just like in macOS.
Now go ahead and give it a try ;-)