3

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?

user1414745
  • 153
  • 1
  • 5

1 Answers1

1

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.