2

This question already has an answer here:

I would like to map the AltGr key on my keyboard to produce Ctrl+Alt. I am aware of xkb and xmodmap. As far as I could tell, however, using those you can only map from key combinations onto single keys, not the other way round.

marked as duplicate by terdon Jun 1 '17 at 8:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You can also access the single-key alternatives for AltGr using the GUI -- to to settings-->Keyboard-->Shortcuts-->Typing-->Alternative Characters Key -- this will give you a drop down with several options. None of them are ctrl+alt, but I figure that it might be useful to others reading this thread. – MattKelly Apr 3 '17 at 12:37
1

After trying and failing to get it to work with a combination of xbindkeys and xvkbd/xte (I could never get certain characters {, [, ], }, \, etc. to behave properly, perhaps because I use a Scandinavian keyboard layout), I finally found a simple and practical solution: Autokey. Here are the exact instructions to get it working:

  1. Install Autokey through Ubuntu Software (I used the GTK-version, not KDE) or by: sudo apt-get install autokey-gtk.
  2. Configure one script per key, e.g. for { use this code: keyboard.send_keys("<alt_gr>+7") and set the hotkey to Ctrl+Alt+7 (first set hotkey to 7 then add Ctrl and Alt as modifiers). This at least worked for the most important code-writing keys: { [ ] } \.
  3. Add autokey to Startup Applications (search for “start” to find it) and then add a program with “autokey” as the command.

This solution will work for anything running in the current X-session (I think) but will not work if you start a new terminal session using Ctrl+Alt+[F2-F6].

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