4

I would like to have the left and right ctrl keys to behave the same. I already have the left key working as it should, in all the shortcuts, etc., but the right one seems to be completely ineffective. I have looked in the keyboard layout options, but with no results.

I am on Linux Mint 20.2, with Mate desktop environment.

--addendum--

The result of xev is as follows:

KeyPress event, serial 35, synthetic NO, window 0x5200001,
root 0x7ac, subw 0x5200002, time 416256, (49,43), root:(2600,505),
state 0x10, keycode 105 (keysym 0xff20, Multi_key), same_screen YES,
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: True

KeyRelease event, serial 38, synthetic NO, window 0x5200001,
root 0x7ac, subw 0x5200002, time 416464, (49,43), root:(2600,505),
state 0x10, keycode 105 (keysym 0xff20, Multi_key), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

The output of xmodmap is as follows:

xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25)
mod1        Alt_L (0x40),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)
7
  • Can you see Control_L and Control_R respectively when you press left and right controls after running xev in the terminal? Commented Dec 31, 2021 at 11:49
  • I see "Control_L" for the left ctrl, but for the right ctrl I receive a "Multi_key".
    – Fabio
    Commented Dec 31, 2021 at 14:28
  • what's the output of your xmodmap?
    – Andra
    Commented Jan 5, 2022 at 21:00
  • 1
    ok, try, first, xmodmap -e "keycode 105 = Control_R NoSymbol Control_R", then xmodmap -e "add control = Control_R". If it doesn't work, then again it would be worth to see the output of xmodmap after these commands, and xev for the right control.
    – Andra
    Commented Jan 6, 2022 at 17:50
  • 1
    Glad to hear it! By the way, you can improve your question if you add xev output showing this Multi_key and the output of xmodmap (like in the comment on Jan 6).
    – Andra
    Commented Jan 10, 2022 at 19:36

3 Answers 3

1
xmodmap -e "keycode 105 = Control_L NoSymbol Control_L"
2
  • I tried this, but it doesn't work, sorry... :(
    – Fabio
    Commented Jan 3, 2022 at 7:46
  • Important note for people who might want to do this on Ubuntu 20+: The default windowing system used is Wayland, in which this won't work. This solution is for X.Org windowing system. You can select the X.Org windowing system (on which this solution should work) in the login screen where you enter your password (click the small gear icon at the bottom right of the screen and select - Ubuntu on X.Org if the two options are Ubuntu and Ubuntu on X.Org - Ubuntu on Wayland if the two options are Ubuntu and Ubuntu on Wayland
    – x__x
    Commented Dec 6, 2022 at 15:25
1

As you confirm in comments, the following two xmodmap commands do the trick:
xmodmap -e "keycode 105 = Control_R NoSymbol Control_R"
xmodmap -e "add control = Control_R"

It will not stay after reboot, so you need to save only the text in quotes in ~/.Xmodmap file and make it executed at startup.

7
  • could you please help with the "after restart" part, please? I have created the ~/.Xmodmap file, I have copied the two lines: keycode 105 = Control_R NoSymbol Control_R add control = Control_R then I have followed all the suggestions in this post: forums.linuxmint.com/viewtopic.php?t=294096 but with no success :(
    – Fabio
    Commented Jan 11, 2022 at 11:15
  • just to see whether the file is ok: if you execute xmodmap $HOME/.Xmodmap in cmd, does the mapping work, no error messages?
    – Andra
    Commented Jan 11, 2022 at 18:20
  • I just tried, xmodmap $HOME/.Xmodmap works, with no error messages!
    – Fabio
    Commented Jan 12, 2022 at 11:26
  • I did a small progress: following the suggestions in forums.linuxmint.com/viewtopic.php?t=294096 I have created ~/.xprofile, and inside I have written: bash -c "sleep 5; xmodmap $HOME/.Xmodmap" & On reboot, the right ctrl has worked, but only for few seconds... then it has gone back to the usual situation :-/
    – Fabio
    Commented Jan 12, 2022 at 14:28
  • 1
    did you also try to add the command (maybe with full path, not $HOME variable) to Startup Applications (try to increase the delay)? And I see that you created a new question - it's better to try to solve this new problem there.
    – Andra
    Commented Jan 12, 2022 at 18:00
0

I have found a more stable and final solution! The behavior I want (both ctrl keys, left and right, having the same behavior) is indeed the default.

My problem was that a keyboard setting was changing this default.

I just found this setting, I have de-selected it, and the default (wanted) behavior is obtained!

The setting is reached as follows:

Keyboard preferences -> Layouts -> Options -> Position of Compose key -> Right Ctrl.

Below I report the screenshots:

first window of the Keyboard Preferences

second window for the layout options

0

You must log in to answer this question.

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