2

Here's the deal I have an apple aluminium usb keyboard connected to my laptop with "windows" keyboard.

And almost everything works great on my apple keyboard except three annoying problems.

  1. Each keyboard must have a different layout, can I specify a layout for each one automatically or do I need to change manually every time ?
  2. On the apple keyboard the key with the ">" and "<" is switched the key with "\" and "|". I know that I can remap keys with xmodmap, but is it possible to remap only to the apple keyboard since the "windows" keyboard is perfectly fine?
  3. This is connected with the second, if can change cmd with alt, but only for the apple keyboard

I'm using linux mint 17 with mate

Edit

I've managed to fix the second problem from the list, it seems it's a known bug from ubuntu https://bugs.launchpad.net/ubuntu/+source/linux/+bug/214786

After reading the comments on launchpad and this page to fix that I had to this:

  1. Append the configuration line to the file /etc/modprobe.d/hid_apple.conf creating it if necessary:

    echo options hid_apple iso_layout=0 | sudo tee -a /etc/modprobe.d/hid_apple.conf

  2. Trigger copying the configuration into the initramfs bootfile.

    sudo update-initramfs -u -k all

Edit 2 So this is the info I get with setxkbmap -print

xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+pt(mac)+pt:2+inet(evdev)"   };
    xkb_geometry  { include "pc(pc105)" };
};

If I try to set the macintosh layout only to my apple keyboard with this command:

setxkbmap -device 11 -v pt -variant mac 

This is the result I get:

xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+pt(mac)+inet(evdev)"    };
    xkb_geometry  { include "pc(pc105)" };
};

If you notice on the line xkb_symbols

I have this: include "pc+pt(mac)+inet(evdev)"

Instead of this:

include "pc+pt(mac)+pt:2+inet(evdev)"

If I find a way of adding the option pt:2 I could create a bash script that would run on startup to set the layout for my apple keayboard solving my first issue from the list.

  • xkb is the way to do it. FWIW the newer xkb is preferred over xmodmap in general. It's faster and has more options (although it's documented more poorly). You can create different options specific to particular keyboards in xorg.conf. However, I notice that you are using Mint, so it probably won't work. FWIW it works fine in Arch. – Sparhawk Aug 6 '14 at 5:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.