# Apple magic keyboard mapping problem under Linux

**URL:** <https://linux-tips.com/t/apple-magic-keyboard-mapping-problem-under-linux/767>\
**Category:** Hardware\
**Created:** [August 19, 2019, 12:11pm UTC](https://linux-tips.com/t/apple-magic-keyboard-mapping-problem-under-linux/767 "2019-08-19T12:11:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![demirten](https://linux-tips.com/user_avatar/linux-tips.com/demirten/32/64_2.png) [@demirten](https://linux-tips.com/u/demirten)\
**Post date:** [August 19, 2019, 12:11pm UTC](https://linux-tips.com/t/apple-magic-keyboard-mapping-problem-under-linux/767/1 "2019-08-19T12:11:29Z")

</div>

If you have a brand new Apple Magic Keyboard and you’re getting wrong key mappings for \< as " and \> as é, you can fix this problem with the following command:

```auto
$ setxkbmap -option apple:badmap

```

If it is works for your environment too, edit `/etc/default/keyboard` file and add or replace **XKBOPTIONS** value as below to make changes permanent:

```auto
XKBOPTIONS="apple:badmap"

```

**EDIT:** If the keyboard connected with Apple Lightning usb cable on Linux bootup, it is not used as a bluetooth keyboard anymore. This time it is recognised as an “AT Raw Set 2 keyboard”. But on this case, if you also provided `apple:badmap` option described in first part of the tutorial, you’ll get the same problem again!

When this is the case, run following command to reset xkboptions:

```auto
$ gsettings reset org.gnome.desktop.input-sources xkb-options

```

and if everything starts to work correctly, you should think about whether do change **XKBOPTIONS** variable in `/etc/default/keyboard` file to its original state or not, depending on your keyboard usage, using through bluetooth or cable.

(Tested on Debian 10)
