Re: [wmii] dmenu patches and os x issue

From: Chris King <colanderman_AT_gmail.com>
Date: Thu, 11 Jan 2007 10:11:49 -0500

On 1/10/07, Alexis Hildebrandt <afh_AT_2drop.net> wrote:
> For some reason the XKeyEvent produced by ALT+g with an Us or Us
> Extended keyboard map matches the Mod1Mask but the KeySym that is
> returned by XLookupString does not match XK_g, but rather XK_copyright
> for Us and Us Extended.

Apple's X11 by default maps the Alt/Option key to Mode_switch, and the
Apple/Command key to Meta_L. Those keycodes are then assigned to mod1
and mod2, respectively. In X windows, Mode_switch also has the side
effect that it causes it to use an alternate set of character mappings
(sort of like a second shift key). This happens regardless of which
modifier Mode_switch is assigned to (unlike the shift key). By
default, Apple sets this alternate character map to be identical to
its extended character map, so that e.g. ALT+g creates a copyright
symbol in both OS X and X11. You can see this mapping by running
xmodmap -pke and looking at the third and fourth columns after the
equal signs. (In fact you can modify it arbitrarily; I used to use a
Greek mapping when I was on Linux.)

The fix I use is to re-map Alt/Option to Meta_L and Apple/Command to
Super_L, and then assign those to modifiers mod1 and mod4,
respectively. (I use Meta_L rather than Alt_L because it has the
additional effect of acting like a modeless escape key in some
terminal apps.) You can accomplish this by adding something like the
following to your ~/.xinitrc (although see note below):

cat << EOF | xmodmap -
keycode 63 = Super_L
keycode 66 = Meta_L
keycode 122 = Insert # This remaps the "Help" key to "Insert"
clear mod1
clear mod2
add mod1 = Meta_L
add mod4 = Super_L
EOF

Note that under X11's preferences, you must disable "Use the system
keyboard layout" or it will reset your changes when wmii starts! Then
you can set up wmii to use mod4 as its modifier and all should be
well.

Hope this helps,
Chris
Received on Thu Jan 11 2007 - 16:12:00 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:18:07 UTC