Tuesday, 10 February 2015

[lubuntu] Correct keyboard layout for Macbook1,1 topic






I am running Lubuntu 14.04.1 on a Macbook1,1 with a US keyboard layout. In this particular layout the SECTION/PLUSMINUS key is where the TILDE key is on most other keyboards, which is left of the 1 key and below ESC. The TILDE key on my keyboard is between the left SHIFT and the Z key.

I have used Keyboard Layout Handler with the following settings:

Model: macbook78
Layout: us(mac) and de(mac)
Options: -option apple:badmap

(For model I also tried all the other Mac variants, but since I am now pretty sure that the problem does not lie there, I have settled on what I think is actually correct: macbook78.)

With this setup I have the correct layout, with the exception of those two swapped keys. After serious study of the xkb files, it appears that this is not a new problem and the option "apple:badmap" is offered to correct the swap. I used xev to make sure that the keys in question returned the appropriate keycodes, so I am fairly certain that "badmap" is the option I need. For good measure, I also tried "apple:goodmap" which has the opposite mapping to "badmap", just in case I had read the files wrong after all ... but no luck there either.

After some more googling I tried setting the layout from the command line using


Code:


$ setxkbmap -model macbook78 -layout "us(mac)" -option -option "apple:badmap" -v 10
Setting verbose level to 10
locale is C
Warning! Multiple definitions of keyboard model
        Using command line, ignoring X server
Warning! Multiple definitions of keyboard layout
        Using command line, ignoring X server
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      macbook78
layout:    us(mac)
options:    apple:badmap
Trying to build keymap using the following components:
keycodes:  evdev+aliases(qwerty)+macintosh(badmap)
types:      complete+numpad(mac)
compat:    complete
symbols:    pc+us(mac)+inet(evdev)
geometry:  macintosh(macbook78)


Apparently setxkbmap is trying to include the badmap keycodes when building the keymap, but when I then print its setup, they are not there.


Code:


$ setxkbmap -print
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)"      };
        xkb_types    { include "complete+numpad(mac)"  };
        xkb_compat    { include "complete"      };
        xkb_symbols  { include "pc+us(mac)+inet(evdev)"        };
        xkb_geometry  { include "macintosh(macbook78)"  };
};


I just ran these commands again, to copy and paste into this post, and they suddenly worked. I got this output, note how the badmap keycodes are included:


Code:


$ setxkbmap -print
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)+macintosh(badmap)"      };
        xkb_types    { include "complete+numpad(mac)"  };
        xkb_compat    { include "complete"      };
        xkb_symbols  { include "pc+us(mac)+inet(evdev)"        };
        xkb_geometry  { include "macintosh(macbook78)"  };
};


I then remembered that I had removed Keyboard Layout Handler from the panel this morning. I added it to the panel again just now and now I'm back with the two keys swapped into the wrong places again! Anyone know what's happening? I would like to be able to swap between the DE and the US layout in the GUI. But it seems that if I want the two troublesome keys in the right places I cannot.






No comments:

Post a Comment