5

I'm a Mac user and I always wonder why there isn't a linux distro that's picked up using the same system of keyboard shortcuts, in particular using the command/super key for typical global shortcuts like +X for "cut", +C for "copy" and +V for "paste".

I appreciate the ability to copy and paste to and from the terminal with the same shortcuts as elsewhere, and I'm puzzled that no linux distros have picked up on this, as typically linux is more terminal focused than macOS. I would have thought that it would make sense to implement this in a linux distro, but it seems like every linux distro ever has just copied their keyboard shortcuts from the windows world where Ctrl is used for standard keyboard shortcuts, necessitating that Shift is also added when you're using the terminal app. That means when you're in the terminal, you have to use a different keyboard shortcut for cut, copy, paste, new window/tab, and quit, etc.

It's probably a minor quibble, but it just seems strange that no one in linux has had this frustration and not thought of the Mac way of doing this and just implemented the standard of using the command/super key for standard keyboard shortcuts in place of Ctrl.

I'm fairly certain that this is not copyrighted by Apple, such a basic concept is almost certainly uncopyrightable.

1
  • Ahh gotta love the macOS keyboard shortcuts of ctrl+K to cut and ctrl+Y to paste, right?
    – Fox
    Feb 14, 2020 at 6:03

5 Answers 5

4

Out of the box many *nix terminals allow copying and pasting text by simply selecting the text you want to copy, and inserting it by pressing the middle mouse button. No additional button presses needed! If that is not a UX improvement, I don't know what is.

Generally speaking, you can swap the Control and Command buttons yourself by using built-in tools such as xmodmap. That will have the effect of having most Apple-style shortcuts feel the same as on Mac.

That said, from my experience as an Apple keyboard user, I found it more convenient to make the Command key function as an Alt and make the Caps Lock and Return keys function as Ctrl when held. You can achieve this by changing the defaults in Apple's keyboard driver hid-apple in conjuction with the xmodmap and xcape utilities.

3

Truth is it is very difficult to implement correctly as a simple key swap is not sufficient, but it is close. If you are mindful of GUI apps vs terminal app differences and potential conflicts within a DE & how that can impact the hotkeys of some hotkey driven apps then you can actually resolve it pretty well with apps like xkeysnail in particular.

Of course there is autokey, xmodmap, xkbcomp, xbindkeys and others that can assist, but I have not found any of them to be as easy to work with if you want to resolve potential conflicts with relative ease.

I am the author of Kinto and I believe I have worked out the most problematic challenges to getting mac like keybinds working under Linux or Windows.

After install if you need to modify the config file for Kinto then look at this location.

vi ~/.config/kinto/kinto.py
sudo systemctl restart xkeysnail
# typically xkeysnail does not install as a service - specific to Kinto only

Windows

~\.kinto\kinto.ahk
# Right click the tray icon and re-apply your keyboard type for changes to take affect

https://github.com/rbreaves/kinto

https://github.com/mooz/xkeysnail

Also if your goal is to have a mac like experience on Linux then I would recommend using Ubuntu Budgie and enabling the built in Global App Menu extension. I have tested this distro, among others with Kinto to ensure that it works as expected. The Solus maintainers of Budgie have also recently accepted a patch upstream so that Kinto will no longer need to patch the DE for proper Cmd-Tab Window/app switching support.

1

This was actually the case in Solaris. The modern equivalent of the Meta key on a modern USB keyboard is the USB HID GUI scancode (Windows key).

For example it's very close to what you mentioned:

  • Meta - C is Copy
  • Meta - X is Cut
  • Meta - V is Paste

Reference: https://docs.oracle.com/cd/E19683-01/806-7612/startup-tbl-5/index.html

Keyboard Left GUI: Windowing environment key, examples are Microsoft Left Win key, Mac Left Apple Key, Sun Left Meta key.

Scancodes: https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf see page 59 footnotes for Left/Right GUI

The options to make use of these keys is still available in GNOME: https://superuser.com/a/1559585

1

TLDR

I think it's a lot more work that it perhaps sounds.


It's true that on a mac you expect to press c instead of ctrlc to copy. But that may be nothing to do with the operating system's code. This is much more likely to be a convention that's followed by many developers.

I've not played with low level Linux GUI code (x11 etc) so I couldn't be sure, but I know in MS Windows, the connection between pressing that key combination and text getting copied to the clipboard is actually made by the application and not the operating system:

  • The OS tells your app the user pressed ctrlc
  • Your app decides to copy some text onto the clipboard

There's just too many variations on what the user might want to happen when those keys are pressed for the OS to take any part in it.

For one example, modern code-editors / IDEs such as PyCharm will make complicated code changes to the code you copy and paste.

Also the "terminal" app has very different behaviour when you select text and press ctrlc to other apps. It doesn't even trigger anything to do with the clipboard.


When software is written for MS Windows or MacOS, it's typically written to run on just that one OS. Even cross platform languages such as Java and Python rely on an interpreter compiled for just that OS and no other. This makes it easy for all software on that OS to follow the same convention.

But when software is written for linux, it is usually written to run on the main distributions (Debian/Ubuntu, Redhat/Centos, Arch Linux ...). Distributions are an amalgamation of a lot of separate pieces of software.

If just one distribution wanted to be different to the others then it would need to change the source code for every GUI app it installs. It wouldn't be able to change proprietary programs so uses would have to live with a mix of c and ctrlc. That's not going to please any users!

OR

It would need to come up with some mechanism to inform software of the what the key combinations meant. And wait for 90%-95% of software vendors to adopt it before it could meaningfully make the switch.

-1

This will make you keyboard works like Mac on Ubuntu wayland.

Remaps Left Ctrl with AltGr

sudo vi /usr/share/X11/xkb/symbols/ctrl

Change the section

// Map Ctrl to the left Alt key, Alt to the left Win key,
// and Super to the left Ctrl key.

when it says "replace key " with

    replace key <LCTL> { [ ISO_Level3_Shift ] };

Open Tweaks

On Additional Layout Options -> Ctrl, mark "Map Ctrl to the left Alt key, Alt to the left Win key, and Super to the left Ctrl key."

On your shell configuration, .zshrc in my case, remap to intr check if you have the cent symbol there before. Add this to the file :

stty intr 0xA2

On gnome-terminal remap the copy and paste shortcuts to "Ctrl C" "Ctrl V"

And move physically your keys to make sense

2
  • Same answer posted on AU, here Jun 17, 2022 at 22:07
  • seems strange to mention wayland and have the path point to x11
    – gotjosh
    Sep 11, 2022 at 9:13

You must log in to answer this question.

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