6

TL; DR

How do I re-map ALT R to work as ALT R instead of ALT Gr on Ubuntu 20.04?

Details

As described in another post, I've executed xev at Ubuntu 20.04 in order to discover ALT L and ALT R keycodes:

  • ALT L keycode 64 (keysym 0xffe9, Alt_L)
  • ALT R keycode 108 (keysym 0xfe03, ISO_Level3_Shift)

Running xmodmap -pke > ~/.Xmodmap, the following configuration was saved:

keycode  64 = Alt_L Meta_L Alt_L Meta_L Alt_L Meta_L
keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift NoSymbol ISO_Level3_Shift

while gsettings provides:

$ gsettings get org.gnome.desktop.input-sources xkb-options
['lv3:menu_switch']

Theoretically re-mapping 108 at ~/.Xmodmap should be enough:

keycode 108 = Alt_R Meta_R Alt_R Meta_R Alt_R Meta_R

However, even running xmodmap ~/.Xmodmap and also saving this command at ~/.xinitrc, the modifications did not take effect immediately or after login again at Ubuntu.

Thus it is not possible to execute extensible commands in Emacs using ALT R + X at Emacs

So what is the proper way of changing ALT R behavior?

References:

  • 1
    Bug reports and problems specific to development version of Ubuntu should be reported on Launchpad https://askubuntu.com/a/5126/197910 so that developers can see, track and fix these issues. – K7AAY Apr 13 '20 at 16:11
  • 1
    https://bugs.launchpad.net/ubuntu/+source/x11-xserver-utils/+bug/1872501 – JP Ventura Apr 13 '20 at 16:24
  • 1
  • 1
    @K7AAY I just made a clean install of 19.10 on VirtualBox and the modifications in .Xmodmap took effect as expected. – JP Ventura Apr 13 '20 at 18:02
  • 1
    @JPVentura: Why would you need to make modifications on 19.10? Which keyboard layout are you using? – Gunnar Hjalmarsson Apr 13 '20 at 18:11
  • 1
    @GunnarHjalmarsson The modifications worked in 19.10 but not in 20.04. I am using English INTL with dead-keys at Microsoft Natural 4000 Wired. Considering I write in PT-BR, EN and use Emacs, this is the best layout. – JP Ventura Apr 13 '20 at 18:17
  • @JPVentura: I see, and I suspect that it's explained by the bug I linked to. With that said, and considering that you disable the access to 3:rd and 4:th level symbols anyway, why don't you simply use the basic English (US) keyboard layout instead of messing with ~/.Xmodmap? – Gunnar Hjalmarsson Apr 13 '20 at 18:38
  • Because I still would not be able to write opção fácil em Brazilian Portuguese ;-). This layout works perfectly on OS X. – JP Ventura Apr 14 '20 at 11:40
  • 1
    @JPVentura: Fair enough. Can you please edit your question and show us the output of the terminal command: gsettings get org.gnome.desktop.input-sources xkb-options – Gunnar Hjalmarsson Apr 14 '20 at 17:19
  • I'm having the exact same problem trying to remap my Control_L key on Ubuntu20.04 and gnome-control-center 3.36.2. According to @Gunnar's bug link, a fix has been provided in 3.36.1 already... Any ideas? – borizzzzz May 30 '20 at 09:07

0 Answers0