[ltp] Gnome 2.6 and those Next Window keys

Thomas de Grenier de Latour linux-thinkpad@linux-thinkpad.org
Fri, 4 Jun 2004 16:22:13 +0200


I'm also using a french keymap with gnome2.6, on a T40. I'm using
X.org here instead of XFree, but I don't think it makes a big
difference.=20

I've managed to get a keyboard that works almost as I want, but as
you will see, my solution is quite ugly.=20

First, I've made my own variant of the keymap to change a few
things. You probably don't need this, or maybe you will prefer
different tweaks. Consider this as an example... At the end of
/etc/X11/xkb/symbols/pc/fr-latin9, I've added:

-----------------------
xkb_symbols "tgl" {
  include "pc/fr-latin9(basic)"
  // =ABguillemets fran=E7ais=BB:
  key <LSGT> { [ less, greater, guillemotleft, guillemotright ] };
  // "=BD", "=BC" and pipe on the upper-left corner key:
  key <TLDE> { [ oe, OE, bar, bar ] };
  // Don't make a non-breaking space on AltGr+Space.
  // (too much typing mistakes in shell...):
  key <SPCE> { [ space, space, space, nobreakspace ] };
  // Right Control key is now Hyper=20
  // (I use that as the default modifier for WM shortcuts):
  key <RCTL> { [ Hyper_R ] };
  // CapsLock is useless, change it to Meta:
  key <CAPS> { [ Meta_L ] };
};
-----------------------

Ideally, XF86Forward and XF86Backward symbols should also be set
this way. But for that to be possible, they should first be
recognized by the keyboard geometry.  This implies to write an
xkb model for thinkpads. I gave up in my doc reading before
doing it...

Then, I've setup my keyboard in X config like this:

-----------------------
Section "InputDevice"
    Identifier  "IBM Thinkpad Keyboard"
    Driver      "Keyboard"
    Option      "AutoRepeat" "500 30"
    Option      "XkbRules"   "xorg"
    Option      "XkbModel"   "pc102"
    Option      "XkbLayout"  "fr-latin9"
    Option      "Xkbvariant" "tgl"
EndSection
-----------------------

For XFree, the XkbRules should be set to "xfree" instead.
This config is not really important because Gnome will override it
anyway (depending of what you choose in the
"gnome-keyboard-properties" tool).=20

I then override also override what Gnome did on startup. I've
written a small ~/bin/keyboard script which contains the
following:=20

-----------------------
#!/bin/sh

# Set the xkbmap: the issue it solves is that I can't
# use the gnome config tool because it doesn't allow me=20
# to choose my custom "tgl" variant.=20
setxkbmap -model pc102 -layout fr-latin9 -variant tgl

# Fix the few remaining issues that are not fixed by the=20
# xkb variant.
/usr/X11R6/bin/xmodmap /home/thomas/.Xmodmap

# Launch "tpb" to get the audio buttons working with OSD.
exec /usr/bin/tpb
-----------------------

I've added this script to my session startup program list using
"gnome-session-properties". The point is that this script gets run
_after_ Gnome has set its own xkb preferences.=20

Also, for eye-candy in the startup screen, I've added
a "keyboard.png" icon in the "/usr/share/pixmaps" directory.

Finally, I've added a few xmodmap commands in ~/.Xmodmap:

-----------------------
!!!!! "Fn" is now Compose
!!! Doesn't work well tho. I have to release it=20
!!! prior to pressing the two chars I want to=20
!!! compose.
keycode 115 =3D Multi_key
=20
!!!!! Makes NumLock somehow work
keycode 77 =3D Num_Lock
=20
!!!!! Forward and BackWard (near the arrow keys)
!!! For some reasons, keycodes have changed at=20
!!! some point here, maybe after I switched to=20
!!! X.org... Check your keycodes with 'xev'.
!keycode 233 =3D XF86Forward
!keycode 234 =3D XF86Back
keycode 117 =3D XF86Forward
keycode 116 =3D XF86Back
-----------------------

And that's it for my configuration. Hope you will find something
usefull in that mess.=20

Oh, and just a small warning: as soon as you change something in
gnome-keyboard-properties, Gnome will reset the keyboard to its
own configuration. You then have to kill tpb and launch
~/bin/keyboard again to re-override its settings.

--=20
TGL.