How do you add keystroke mappings to en_US to type additional characters?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How do you add keystroke mappings to en_US to type additional characters?
First, I am not trying to change my keyboard language. I want to keep my en_US keyboard. I am using Linux Mint 20.1 and Cinnamon.
I am taking a German language class and I want to add mappings for existing keys on my en_US keyboard to type the German characters Ä Ö Ü ß. Because copying these characters from Character Map is getting to be a real pain!
For example, what I want to do:
xmodmap tells me the semi-colon, colon key is keycode-47. This is where 'Ö' is located on the German keyboard.
I still want keycode-47 to type ';' and Shift+keycode-47 to type ':'. Additionally, I want to add mappings so that Alt-L+keycode-47 types 'ö' and Cntl-L+keycode-47 types 'Ö'.
Keysymdef.h tells me 'Odiaeresis' is the keysym name for the character. But when I put that value in .Xmodmap on keycode-47 and run 'xmodmap .Xmodmap', it hard locks the computer and I have to hit 'reset'.
It seems like this should be simple; "Alt-L+this-key types this character", but I've searched and Googled and experimented, and I'm stuck.
There is a different approach than mine, and it had been proposed on LQ somewhere. I do not comprehend how you used xmodmap until now.
First find the keycodes with xev.
Then I use xmodmap with — as argument — a small file containing the additional — or altered — character-mappings.
Mine looks like this (! is the comment symbol):
Code:
! Ω and @
keycode 24 = q Q q Q at Greek_OMEGA at
! œ and Œ
keycode 32 = o O o O oe OE oe
! λ and Λ (greek_lambda)
keycode 46 = l L l L U03BB U039B U03BB
! δ and Δ (greek_delta)
keycode 40 = d D d D U03B4 U0394 U03B4
! ω (greek_omega)
keycode 25 = w W w W U03C9
! ✅ and ✔
keycode 44 = j J j J U2705 U2714
My own keyboard layout is QWERTZ or AZERTY, the default-keys may thus vary.
Last edited by Michael Uplawski; 06-05-2021 at 02:05 AM.
Reason: kraut2english
While hacking existing keyboard layout is a valid approach, you will find that you system already has a number of preconfigured US keyboard layouts with international characters. Look in keyboard variants section in GUI setup for ones that have international in the name or from commandline set the appropriate variant as one of the arguments for 'localectl set-x11-keymap'. I personally prefer variants supporting dead keys when you can use tilde or grave as prefix to modify next character.
One way is to switch your layout to English (US, international with dead keys) Then you can get the vowels with unlauts by using the AltGr key and q for ä, y for ü, and p for ö. AltGr and s will give you ß.
While hacking existing keyboard layout is a valid approach, you will find that you system already has a number of preconfigured US keyboard layouts with international characters. Look in keyboard variants section in GUI setup for ones that have international in the name or from commandline set the appropriate variant as one of the arguments for 'localectl set-x11-keymap'. I personally prefer variants supporting dead keys when you can use tilde or grave as prefix to modify next character.
Quote:
Originally Posted by DavidMcCann
One way is to switch your layout to English (US, international with dead keys) Then you can get the vowels with unlauts by using the AltGr key and q for ä, y for ü, and p for ö. AltGr and s will give you ß.
Linux Mint 20.1, Cinnamon has 18 flavors of English from all over the world; Antigua to Zimbabwe. Not one of them is any form of English (US, International). So......
I will investigate the "compose key" and see if I can make that work.
Linux Mint 20.1, Cinnamon has 18 flavors of English from all over the world; Antigua to Zimbabwe. Not one of them is any form of English (US, International). So......
So you are looking in the wrong place. Not layouts - variants. Layout: English US, variant: English (US, intl., with dead keys).
Code:
$ egrep -i </usr/share/X11/xkb/symbols/us "(intl|international)"|grep name
name[Group1]= "English (US, intl., with dead keys)";
name[Group1]= "English (US, alt. intl.)";
name[Group1]= "English (Dvorak, intl., with dead keys)";
name[Group1]= "English (Dvorak, alt. intl.)";
name[Group1]= "English (intl., with AltGr dead keys)";
name[Group1]= "USA - ClassmatePC (International)";
name[Group1]= "USA - ClassmatePC (Alternative international)";
name[Group1]= "USA - ClassmatePC (International Fn+Alt dead-keys)";
name[Group1]= "English (Workman, intl., with dead keys)";
name[Group1]= "English (Carpalx, intl., with dead keys)";
name[Group1]= "English (Carpalx, intl., with AltGr dead keys)";
name[Group1]= "English (Carpalx, full optimization, intl., with dead keys)";
name[Group1]= "English (Carpalx, full optimization, intl., with AltGr dead keys)";
name[Group1]= "English (US, international AltGr Unicode combining)";
name[Group1]= "English (US, international AltGr Unicode combining, alternative)";
So you are looking in the wrong place. Not layouts - variants. Layout: English US, variant: English (US, intl., with dead keys).
Code:
$ egrep -i </usr/share/X11/xkb/symbols/us "(intl|international)"|grep name
name[Group1]= "English (US, intl., with dead keys)";
name[Group1]= "English (US, alt. intl.)";
name[Group1]= "English (Dvorak, intl., with dead keys)";
name[Group1]= "English (Dvorak, alt. intl.)";
name[Group1]= "English (intl., with AltGr dead keys)";
name[Group1]= "USA - ClassmatePC (International)";
name[Group1]= "USA - ClassmatePC (Alternative international)";
name[Group1]= "USA - ClassmatePC (International Fn+Alt dead-keys)";
name[Group1]= "English (Workman, intl., with dead keys)";
name[Group1]= "English (Carpalx, intl., with dead keys)";
name[Group1]= "English (Carpalx, intl., with AltGr dead keys)";
name[Group1]= "English (Carpalx, full optimization, intl., with dead keys)";
name[Group1]= "English (Carpalx, full optimization, intl., with AltGr dead keys)";
name[Group1]= "English (US, international AltGr Unicode combining)";
name[Group1]= "English (US, international AltGr Unicode combining, alternative)";
Good Grief! That was hard to find. There is just a little unlabeled '+' sign at the bottom of the layout window. When you first click on it, all you see are a bunch of other languages and the popup window says "choose a layout", so I never scrolled the list any further - thinking it meant add another language. When I scrolled down farther, there were these variant selections. It could be better designed. So now it is working. Thank you so much.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.