3

I just installed Fedora 24 with Cinnamon desktop on a MacBook Pro and I'm having issues with the keyboard.

When I press the key directly above the tab which should be ` and ~ I am instead getting < and >. All of the other keyboard on my keyboard are working correctly.

I have tried the following layouts and this is what they display without and with shift key:

  • English (US)
    • Prints < and >
  • English (US, alternative international)
    • Prints \ and |
  • English (US international with dead keys)
    • Prints \ and |` and ~
  • English (Macintosh)
    • Prints § and ±

Does anybody know how to get the key to correctly display ` and ~

Edit: Output from localectl and setxkbmap

$ localectl
   System Locale: LANG=en_US.UTF-8
       VC Keymap: us
      X11 Layout: us
$ setxkbmap -print
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)"    };
    xkb_types     { include "complete"    };
    xkb_compat    { include "complete"    };
    xkb_symbols   { include "pc+us+inet(evdev)"    };
    xkb_geometry  { include "pc(pc105)"    };
};
1
  • in a terminal, run the commands localectl and setxkbmap -print and add the output into your post. see the xkb tag.
    – quixotic
    Mar 13, 2017 at 22:49

1 Answer 1

3

This may be a known bug (redhat, ubuntu, askubuntu). The workaround from those bugs is:

echo 0 > /sys/module/hid_apple/parameters/iso_layout

Try running that command to test (you may need to wrap it with sudo sh -c "echo..." to run it as root). If that fixes the issue, make it permanent by placing it in an rc.local script (or a systemd equivalent) so it runs at boot time.

If that works, it should affect the keys in both X and console environments. The XKB solution below would only affect X.


You can also fix this in XKB. On Debian/Ubuntu (and possibly others), the XKB options apple:badmap and apple:goodmap exist to swap these key definitions automagically. These can be set in /etc/default/keyboard to take effect systemwide or used with setxkbmap or your DE's keyboard setting utility on a per-user level.

These answers (unix.SE, askubuntu) recommend making changes to a system file (/usr/share/X11/xkb/symbols/pc or /usr/share/X11/xkb/symbols/us) to alter the mac variant.

The suggested alteration will allow loading the proper keys with setxkbmap -layout us -variant mac:

orig:
xkb_symbols "mac" {

    include "us(basic)"
    name[Group1]= "English (Macintosh)";
    key.type[group1]="FOUR_LEVEL";

    // Slightly improvised from http://homepage.mac.com/thgewecke/kblayout.jpg
    key <LSGT> { [   section,  plusminus,       section,        plusminus ] };
    key <TLDE> { [     grave, asciitilde,    dead_grave,        dead_horn ] };


fix: swap key definitions:
    key <TLDE> { [   section,  plusminus,       section,        plusminus ] };
    key <LSGT> { [     grave, asciitilde,    dead_grave,        dead_horn ] };

(On my Arch system, this is in /usr/share/X11/xkb/symbols/us; it may look different if your system has it in /usr/share/X11xkb/symbols/pc, but swapping the key names should be the same.)

If your system upgrades the XKB symbol database, your changes may be overwritten and you'll need to apply this change again. See my answer to another XKB question for a method of making that change as a user-customization.


You may need additional steps to disable GNOME's keyboard settings (or convince them to use the settings you've selected).

7
  • note there are several mac-based keyboard models in XKB (localectl list-x11-keymap-models | grep mac); one of them may already contain a fix for this issue. you can test with setxkbmap -layout us -variant mac -model macbook78.
    – quixotic
    Mar 14, 2017 at 15:57
  • I had the problem with Ubuntu 16.10 on a MacBook Pro 2015. I'm using the us(mac) layout and fixed the problem with the solution modifying the /usr/share/X11/xkb/symbols/us file. ± is now on <Alt_R+Shift+=> and § is now on <Alt_R+6>.
    – Creak
    Mar 25, 2017 at 17:30
  • @Creak i learned yesterday that debian/ubuntu & derivatives include an apple:badmap option in XKB to swap the <TLDE>/<LSGT> definitions. for you, using that (set in /etc/default/keyboard) would avoid the problem reverting when your altered us file gets overwritten by an update.
    – quixotic
    Mar 25, 2017 at 20:10
  • That would be way cleaner! What would be the command (or steps) to change that?
    – Creak
    Mar 28, 2017 at 0:28
  • debian adds it in a patch when they package their xkeyboard-config from the upstream; doesn't look like fedora does the same. (no hits with grep -r badmap /usr/share/X11/xkb on Fedora 25.) assuming you don't want to switch to Debian ... you could roll your own xkeyboard-config rpm applying that patch ... i'm not sure that's still "cleaner", but it would be more maintainable. (if Fedora updates the package, you'd just reroll based on the new source and use your patched version.)
    – quixotic
    Mar 28, 2017 at 3:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .