12

While there is a similar question how to make Mac keyboard like Ubuntu, I would like to raise the reverse question: How to make Ubuntu keyboard like Mac?

I like for instance cmd ⌘ to work as ctrl (i.e. To press cmd ⌘+C for copy in Ubuntu). This makes the life easier when using an Ubuntu virtual machine on Mac, no need anymore to think if you are doing on Mac or virtual Ubuntu. Since my brain works out of OS X all day long and I'm running ubuntu and other OS inside virtualization (like virtual box), making these guest OS run more like my host OS would save me confusion.

How to make Ubuntu's mapping of my Mac's keyboard be more Mac-like?

2 Answers 2

12

Update 02/03/2020

Kinto - Type in Linux like it's a Mac.

Kinto has now been rewritten in C for Ubuntu/Debian systems using x11. It also uses json config files, making it easier to manage and extend to other applications than just terminals. The app no longer maps to Super in the Terminal apps, it will now properly map to Ctrl+Shift to create the exact same feel as having a Cmd key.

Please checkout the latest release. https://github.com/rbreaves/kinto

The main change to allow for the Super = Ctrl+Shift change is in this symbols file.

default partial xkb_symbols "mac_levelssym" {
    key <LWIN> {
      repeat= no,
      type= "ONE_LEVEL",
      symbols[Group1]= [ Hyper_L ],
      actions[group1]=[ SetMods(modifiers=Shift+Control) ]
    };
    key <RWIN> {
      repeat= no,
      type= "ONE_LEVEL",
      symbols[Group1]= [ Hyper_R ],
      actions[group1]=[ SetMods(modifiers=Shift+Control) ]
    };
};

You may find Kinto to be useful. It's a project I recently created, after a few years of tackling this problem a few different ways and I just now feel like it's solid enough to share.

The Kinto installer simply uses python to do the initial install, after that it's just a systemd service, bash, xprop, setxkbmap and xkbcomp. As far as I am concerned it is the fastest and most native solution to this problem that you are going to find.

https://github.com/rbreaves/kinto

https://medium.com/@benreaves/kinto-a-mac-inspired-keyboard-mapping-for-linux-58f731817c0

Here's a Gist as well, if you just want to see what is at the heart of it all, it will not alternate your keymap when needed though. The Gist also does not include custom xkb keymap files that setup macOS style cursors/word-wise manipulations that use Cmd and the arrow keys.

https://gist.github.com/rbreaves/f4cf8a991eaeea893999964f5e83eebb

2
  • This made a disaster of my configuration. Workspace switching is completely messed up, partially successful configuration settings in several critical apps. A lot of effort to recover. Use at your own risk. This brings the count of partially overlapping configuration-setting apps for my Ubuntu setup to 5, and initiates a new quest for a different linux distro, where these things are sensibly thought about by sensible people instead of tasking the users with navigating through this nightmare
    – iggie
    Commented Aug 27, 2020 at 17:35
  • The uninstaller, had you ran it, should restore your original shortcut hotkeys, it also gives the option to reset to factory defaults of the OS shortcuts as well. Additionally, if you customized your shortcuts before installing Kinto, on supported distros, then you may experience a few non-working remaps. I will be releasing Kinto v1.2 soon that will make fewer, if any, OS level shortcut changes, which are already limited to the bare minimum required. If you would not mind please open an issue ticket on my repo and I can provide more help there as well as guidance & explanations if needed.
    – R Ben R
    Commented Aug 27, 2020 at 22:03
5

I found my answer on the link below:

Copy-paste with ⌘-c and ⌘-v in ubuntu running in virtualbox (on an OSX host)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .