LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 06-04-2021, 02:58 PM   #1
ronsmeyer
LQ Newbie
 
Registered: Aug 2015
Location: Saint Louis
Distribution: Mint
Posts: 14

Rep: Reputation: Disabled
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.

Does anyone know how to map a keyboard like this?

Last edited by ronsmeyer; 06-04-2021 at 03:40 PM.
 
Old 06-05-2021, 02:01 AM   #2
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,621
Blog Entries: 40

Rep: Reputation: Disabled
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
 
Old 06-05-2021, 04:43 AM   #3
lvm_
Member
 
Registered: Jul 2020
Posts: 924

Rep: Reputation: 336Reputation: 336Reputation: 336Reputation: 336
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.
 
Old 06-05-2021, 10:55 AM   #4
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,139

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
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 ß.

Another method is to enable a compose key — the Windows menu key is a good choice, being redundant in Linux. then you have the sequences
Comp " a for ä
Comp " u for ü
Comp " o for ö
Comp ss for ß
That is actually more use, as there are lots of compose sequences built in: 12 for ½, oc for ©, oo for ° and so on.
 
Old 06-05-2021, 11:48 AM   #5
ronsmeyer
LQ Newbie
 
Registered: Aug 2015
Location: Saint Louis
Distribution: Mint
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by lvm_ View Post
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 View Post
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 ß.

Another method is to enable a compose key — the Windows menu key is a good choice, being redundant in Linux. then you have the sequences
Comp " a for ä
Comp " u for ü
Comp " o for ö
Comp ss for ß
That is actually more use, as there are lots of compose sequences built in: 12 for ½, oc for ©, oo for ° and so on.
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.
 
Old 06-05-2021, 01:58 PM   #6
lvm_
Member
 
Registered: Jul 2020
Posts: 924

Rep: Reputation: 336Reputation: 336Reputation: 336Reputation: 336
Quote:
Originally Posted by ronsmeyer View Post
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)";
 
Old 06-05-2021, 03:22 PM   #7
ronsmeyer
LQ Newbie
 
Registered: Aug 2015
Location: Saint Louis
Distribution: Mint
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by lvm_ View Post
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.
 
Old 06-06-2021, 02:34 AM   #8
lvm_
Member
 
Registered: Jul 2020
Posts: 924

Rep: Reputation: 336Reputation: 336Reputation: 336Reputation: 336
That's gnome for you. This is how it looks on KDE.

Click image for larger version

Name:	Screenshot_20210606_102918.png
Views:	15
Size:	21.7 KB
ID:	36533
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ldap_add undefined attribute type (17) additional info attribute type undefined yashfire007 Linux - Newbie 6 03-20-2015 09:12 AM
[SOLVED] seeking keystroke entry of special characters SaintDanBert Linux - Desktop 2 07-08-2010 08:12 PM
ldap_add: Undefined attribute type (17) additional info: ojectclass: attribute type vinaytp Linux - Newbie 2 05-28-2009 04:57 AM
gtkrc.en_us not found paulr1984 Linux - Software 0 05-01-2005 10:15 PM
locale is en_US.UTF-8, but gnome turns out to chinese envirement donkey301 Debian 1 03-02-2005 10:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration