19.10: Deactivate Alt Key From Triggering Applications' Menu Bar

Solution 1:

You can do so by modifying the XKB configuration file like so:

  1. Edit the XKB /usr/share/X11/xkb/symbols/pc file by running the following command in the terminal:
sudo nano /usr/share/X11/xkb/symbols/pc
  1. Find the line that contain include "altwin(meta_alt)" like so:
key <ALT>  {        [ NoSymbol, Alt_L       ]       };
include "altwin(meta_alt)"
  1. Comment it out by adding // before it like so:
key <ALT>  {        [ NoSymbol, Alt_L       ]       };
// include "altwin(meta_alt)"
  1. Save the file and exit the editor by pressing Ctrl + X then press Y.

  2. Clear the XKB cache by running the following command in the terminal:

sudo rm -rf /var/lib/xkb/*
  1. Reboot your system to activate your new XKB configuration or alternatively you can avoid the reboot and try to reload the new XKB configuration by setting an XKB map layout using the following command in the terminal:
setxkbmap -layout us

Notice:

If you choose to avoid the reboot and reload the new XKB configuration withe this command, layout switching will only be possible through the terminal and layout switching using hotkeys or the GUI will stop responding until you reboot the system.

  1. Test your key.

This solution should disable the ALT functionality, but the physical key Alt itself will remain functional. So the key code can be detected by a utility like xev and then remapped for example to "Super Right" like so (replacing 64 with the detected key number):

xmodmap -e 'keycode 64 = Super_R'

It will then be available for use as a hot key or shortcut key exactly like ALT minus the undesired behavior.

Please refer to this answer for help