A macOS like keyboard remap for Linux with GNOME shell (Ubuntu, Fedora)

Petr Stepanov
2 min readMar 12, 2019

--

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:

  1. Have left control working in Terminal to be able to kill processes with control+c, use default combinations for Nano editor etc.
  2. 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.
  3. 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 uses control+space to display assistant. So we need to differentiate between command and control keypress.
  4. Next thing we want to imitate the home and end keys functionality with macOS command+left and command+right combinations; not to mention the shift modifier that adds selection.
  5. Its nice to have some Finder key combinations in Nautilus: command+up or command+down to navigat`e in the file system, command+shift+. to show hidden files and so on.
  6. 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 ;-)

--

--

Petr Stepanov
Petr Stepanov

Written by Petr Stepanov

Gamma-spectroscopy. Positron annihilation spectroscopy. M.S. in solid-state physics. PhD in photochemical sciences. Desktop, frontend and iOS developer.

Responses (1)