0

I am on ubuntu 20.04 and I have attached a Logitech Keyboard with Macintosh Layout. Withing settings I was able to add this Layout and viewing it from the Settings yields that image:

German Macintosh layout

The Keyboard itself does exactly look like the one on the image, but two keys are swapped when pressing them.

These are: ^ and <. In other words »caret key and greater key« need to be remapped.

How can I do that?

UPDATE Following some tutorial on the web just ran those commands:

xmodmap -pk | grep -i greater
…
94      0x003c (less)   0x003e (greater) …
…

xmodmap -pk | grep -i less
…
94      0x003c (less)   0x003e (greater) …
…

xmodmap -pk | grep -i asciicircum
…
15      0x0036 (6)  … 0x005e (asciicircum)
…

xmodmap -pk | grep -i degree
19 …
34 …
49 …

So, finding the key with the ^ is somewhat difficult

Update #2

  1. using xmodmap -pke makes it much easier to find the keys
  2. finally that fixed the issue:
xmodmap -e "keycode 94 = dead_circumflex degree dead_circumflex degree U2032 U2033 U2032 U2033 grave asciitilde"
xmodmap -e "keycode 49 = less greater less greater bar dead_belowmacron bar dead_belowmacron less greater bar dead_belowmacron"
philipp
  • 359
  • 2
  • 7
  • 15
  • Run `xev` from a terminal. This will give you a new window. Place your mouse cursor in this window and press the ^ key. – Jos Feb 02 '22 at 10:52
  • thanks! Now I now the key codes: 94 and 49 – philipp Feb 02 '22 at 11:07
  • 1
    Does this answer your question? [Key '@' (Keycode 49) and key '<' (keycode 94) are inverted on macbookPro keyboard](https://askubuntu.com/questions/843590/key-keycode-49-and-key-keycode-94-are-inverted-on-macbookpro-keyboar) – Gunnar Hjalmarsson Feb 02 '22 at 13:57
  • @GunnarHjalmarsson Well that solution looks pretty nice, gonna give it a shut. – philipp Feb 03 '22 at 05:29

1 Answers1

0

So the command that solves the problem for me is that one:

xmodmap -e "keycode 94 = dead_circumflex degree dead_circumflex degree U2032 U2033 U2032 U2033 grave asciitilde"
xmodmap -e "keycode 49 = less greater less greater bar dead_belowmacron bar dead_belowmacron less greater bar dead_belowmacron"

I have put it in a script ~/swap-keys.sh and each time I am using the apple keyboard, I ran this and it works.

philipp
  • 359
  • 2
  • 7
  • 15