I just installed VirtualBox (from Oracle) in Windows 7, and created a virtual machine with latest Ubuntu.
Here in Firefox I can use the left Ctrl key, while the right one doesn't have any effect. However, I can't use the AltGr key (also known as Right Alt) to produce e.g. curly braces like {} (I pasted that via Ctrl V).
In a terminal window I can switch the "Input method" to "Multipress", and then I can use AltGr to type e.g. {}, which is how I produced those characters for this posting. However, with "Multipress" the Ctrl keys seem to have no effect whatsoever. So in order to e.g. type Ctrl D I have to right click and switch the "Input method" to "System (IBus (Intelligent Input Bus))". Then AltGr does not work.
I tried specifying the compose key in the system settings keyboard layout.
With that, neither Ctrl nor AltGr worked.
Here's what xmodmap reports:
[~] $ xmodmap -pke | grep -i control keycode 37 = Control_L NoSymbol Control_L keycode 105 = Control_R NoSymbol Control_R [~] $ xmodmap -pke | grep -i alt keycode 64 = Alt_L Meta_L Alt_L Meta_L keycode 204 = NoSymbol Alt_L NoSymbol Alt_L [~] $ _
How can I fix this?
Additional info: the keyboard is a standard PC keyboard, a Logitech K120, with Norwegian layout.
Also, I first tried asking this question over at the Superuser site but no response after 2 days…
Best Answer
Run the command
xev
. In the xev window, press the AltGr key. You'll see something likeNote the keycode; since the key isn't doing what you want, you'll see something else (possibly
Alt_R
) instead ofMode_switch
. You want to assign this keycode toMode_switch
, which is X11's name for AltGr. Put the following command in a file called.Xmodmap
(note capitalX
) in your home directory:Additionally, you may need to assign a modifier to
Mode_switch
, but if all that's happening is a keycode discrepancy there'll already be one. See Set the key for spanish eñe letter for more information.Run
xmodmap ~/.Xmodmap
to test your file. On many systems, including Ubuntu 10.04, this file is loaded automatically in the default Gnome environment. On other distributions or environments, you may need to indicate explicitly that you want to runxmodmap ~/.Xmodmap
when you log in.