Ubuntu – How to remap key with shift and alt modifier using xmodmap

keyboard-layoutxmodmap

I want to put have the following behaviour for key with code 94:

1) by default it is '<'

2) with shift it is '>'

3) with alt it is '|'

I only managed to get the default and shift behaviour by using command (names are from xev):

xmodmap -e "keycode 94 = less greater"

I tried three thing to all of the behaviour:

1)

xmodmap -e "keycode 94 mod1 = less greater bar"

2)

xmodmap -e "keycode 94 shift mod1 = less greater bar"

3)

xmodmap -e "keycode 94 = less greater"
xmodmap -e "add mod1 = less bar"

First two add the effect of having '<' by default and '|' with shift. I'm not entirely sure what the third one did.

I also got the same behaviour as in 1) and 2) (shift is relevant, alt does nothing) from command:

xmodmap -e "keycode 94 mod1 = less bar"

My information is mostly based this answer (especially the bonus section).

How to map a single key to have a different default, shift and behaviour based on modifier(s)?

Best Answer

Just found out, heuristically ! Look at the following :

xmodmap -e "keycode 38 = a A aacute Aacute ae AE ae"

It's basically

  1. a: normal a
  2. A: shift + a
  3. á: altgr + a
  4. Á: shift + altgr + a
  5. æ: [some modifier combination] + a
  6. Æ: shift + [some modifier combination] + a
  7. æ: ???

So just reconfigure the key with the representations you want. For example, I reassigned period + altgr to interpunct (a bit expedient though):

xmodmap -e "keycode 60 = period greater 0x00b7 0x00b7 0x00b7 0x00b7"