3

In macOS, the "system modifier key" (the key for system-wide OS shortcuts like copy, paste, etc.) is cmd, which is separate from the ctrl key. This means that the cmd key can be used for things like opening new browser tabs and copy/pasting system-wide, and the ctrl key can be used for navigating text emacs style (e.g. ctrl-a to go to start of line anywhere in the OS).

Since switching to Debian, I've been extremely frustrated by not having this separation. It means that my muscle-memory ctrl-a to go to the start of the line instead selects all text (like cmd-a would on a mac).

Is there any way to reassign the duties of the ctrl key to a different key? This does not mean remap ctrl to a different key on the keyboard; I still want ctrl to exist, but I don't want it to be used for things like copy/paste, I want a different modifier key to do this and leave ctrl free for emacs-style commands.

I understand that this may be difficult to do in all cases, but even if I could make it work in Chrome, terminal, and some IDEs that'd be good enough.

1
  • Command + Space
  • Search for Keyboard (also you can go from settings -> Keyboard)
  • Select Subtab - Keyboard
  • Click on Modifier keys
  • Change as you wish. Hope this helps. Here is screen shot of modifier keys!!

Modifer Keys

| improve this answer | |
  • I believe that you might have misunderstood the question. – Scott May 12 '19 at 0:51
  • Right, this is not what I meant. – Conor Taylor May 16 '19 at 17:23
0

One thing I've found in the past few days that can be adapted to this use case is AutoKey. It allows you to (among other things) run python scripts on specific key combinations to modify their actions. This can be used to mimic a macOS keyboard in Linux (where ctrl is its own key, and cmd in this case can be considered synonymous with alt or win).

For example, to change ctrl-a to go to the beginning of the line (emacs style), and use alt-a for select all, I wrote the following script:

import re

if re.match('.*Gnome-terminal', window.get_active_class()):
  keyboard.send_keys("<ctrl>+a")
else:
  keyboard.send_keys("<home>")

This allows ctrl-a to retain its behavior in the terminal, but go to the beginning of the line is all other programs (e.g. Chrome and IntelliJ). In AutoKey this is bound to ctrl-a and runs whenever that shortcut is pressed.

Another example is using alt-w to close tabs (e.g. in Chrome, IntelliJ and the Terminal). This can be done with this script bound to alt+w:

import re

if re.match('.*(Gnome-terminal|jetbrains-clion)', window.get_active_class()):
  keyboard.send_keys("<ctrl>+<shift>+w")
else:
  keyboard.send_keys("<ctrl>+w")
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.