[ltp] T40 forward/back keys in Mozilla

Jacob H-A linux-thinkpad@linux-thinkpad.org
Mon, 8 Dec 2003 01:07:41 -0800


My T40 has these two blue forward/back buttons above the cursor keys.
I've found them really useful, but I found it surprisingly difficult to
map them properly in Mozilla, so I'm providing instructions if anyone
else is interested.  YMMV.

Background:
According to http://www.mozilla.org/unix/customizing.html#keys,
you can bind keys using either XUL or XBL.  Unfortunately there
seems to be no working command for "Forward" or "Back" under XBL.
Instead you have to use XUL, and the only way to bind keys with
XBL appears to be modifying /usr/lib/mozilla/chrome/comm.jar.

First, add the following lines to your .xmodmap to map the special
keycodes to keysyms F19 and F20:

  keycode 234 = F19
  keycode 233 = F20

Next, unpack comm.jar:

  unzip /usr/lib/mozilla/chrome/comm.jar -d /tmp

Edit /tmp/content/navigator/platformNavigationBindings.xul and add the
following two lines under the <keyset id="navigationKeys"> section:

  <key id="goBackKb2"  keycode="VK_F19" command="Browser:Back"/>
  <key id="goForwardKb2"  keycode="VK_F20" command="Browser:Forward"/>

Repack comm.jar and move it back into place:

  cd /tmp
  zip -rD0 comm.jar content/
  sudo cp --backup comm.jar /usr/lib/mozilla/chrome/comm.jar

Restart Mozilla and you should have working Forward/Back keys.

-- 
Jacob Hoffman-Andrews
#!/bin/sh
Q=`printf "\047"`;q(){ printf "%s\n" "$1$Q$1$Q>>.signature";};q '#!/bin/sh
Q=`printf "\047"`;q(){ printf "%s\n" "$1$Q$1$Q>>.signature";};q '>>.signature