I usually use 3 keyboard layouts: US, BG, DE. As I need the DE layout only for Umlaute, I found the solution with modifying the keys in ~/.Xmodmap. The command xmodmap ~/.Xmodmap
changes my US layout in the desired way. But it has a side effect, it also changes my BG layout - the Euro sign is the default sigh for the key e
. How can I apply the command only for the US layout?

- 153
- 1
- 5
-
has nobody seen this problem? – user1414745 Oct 14 '13 at 22:36
-
I have a similar problem. I use four layouts and my xmodmap mapping changes work on the DE and GB layout, but not on the JP and PL layout. Maybe a better question would be how xmodmap and the inbuilt GUI keyboard-layout settings work together. Also related:Remap keyboard using xmodmap with layouts – fifaltra Jun 24 '14 at 02:39
-
How has no-one answered this question in 8 years, I have this exact same problem, I think I'll make a new question if someone that knows a solution might find it. – Miika Vuorio Sep 15 '21 at 09:56
1 Answers
I had a similar problem but where I needed to map a certain key to "n" in my English layout and "ν" (the Greek letter for "n") in my Greek layout. I was using xmodmap -e "keycode 24 = n"
to remap the English key, but then the "q" key (key code 24) did nothing in my Greek layout rather than printing "ν" as desired.
Eventually, I found out that you can map the same key code to multiple keysym values like this: xmodmap -e "keycode 24 = n N Greek_nu Greek_NU"
. The first one is the the default value, the second is when "shift" is applied, the third is the default for my secondary layout, and the fourth is for when "shift" is applies to my secondary layout.
In order to find the correct order and keysym name, you can enter xmodmap -pk
in the terminal to print a table with your present key map. The names for each key code will be in parenthesis and in the order that they will need to appear in your xmodmap -e
command. For example, my table for the original "n" key (which is broken) is
57 0x006e (n) 0x004e (N) 0x07ed (Greek_nu) 0x07cd (Greek_NU)
which is how I knew to have "n N Greek_nu Greek_NU" in that order.
For your case, I'd imagine that all you'd have to do is set the first two values to be what you want for your English layout, and then the next four (since you have three layouts) to be their original values.

- 111