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.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.