I'm trying to create a keyboard mapping to insert a unicode character via the keyboard. It appears that xmodmap is perhaps the best option, but I can't figure out how to get a third-level character.
I have my third-level chooser mapped to Right-Win key, and this works for characters like the EuroSign. I used that key as my pattern. xmodmap -pk
shows this for EuroSign
26 0x0065 (e) 0x0045 (E) 0x0065 (e) 0x0045 (E) 0x20ac (EuroSign) 0x0000 (NoSymbol) 0x20ac (EuroSign) 0x20ac (EuroSign)
So I setup my comma line to try and match that
keycode 59 = comma less comma semicolon UFF62 UFF62 UFF62 UFF62
But this doesn't work, despite xmodmap -pk
reporting a similar output as EuroSign
59 0x002c (comma) 0x003c (less) 0x002c (comma) 0x003b (semicolon) 0x100ff62 (UFF62) 0x100ff62 (UFF62) 0x100ff62 (UFF62) 0x100ff62 (UFF62)
Note that if I put UFF62
as the first entry I can successfully replace the comma itself. That confirms at least that I've modifying the right file and the character is valid.
How do I get my Unicode character assigned to the third level?
UPDATE: This appears to only not work if I have the US-generic keyboard layout. When I switch to my German layout the mapped keys work. Is there something I have to do to enable the third-level ont he keyboard layout?
Note, my use-case is to just get a key mapped to a character. I also tried xbindkeys with xvkbd, but was unable to get it to insert unicode characters correctly. I also tried xdotool, but it also seemed to have trouble with unicode characters.
This question is really old, and the only reason I'm here is because of an online search term query, which led me into some of my own correlation and research, so I'll be brief in my answer.
I've read it on the Arch Wiki, and there seems to be a known issue. Apparently, there is some kind of incompatibility regarding US keyboard layouts and the 3rd Level. The only way to use the 3rd level seems to be by using the International US layout, which can by done by typing
setxkbmap -layout 'us(intl)'
in the Terminal, or setting it permanently through the Xorg configuration files.This was written in the best interest of anyone else searching for the same answer. Hope this helps those in the future. If this does not answer your question, the answer may be within the Xorg settings.