Ninja Nichols

The discipline of programming

Convenient Keys

As a programmer, I use all of my 104 keys but I use some a lot more than others. Take for instance the Home and End keys. On my old laptop those were pretty easy to get to, but on my new ThinkPad 510 I’m constantly reaching up above the Backspace key to hit them. It gets annoying. My solution involvesĀ re-purposingĀ the “Browser_forward” and “Browser_back” keys which are conveniently located to the right and left of my Up Arrow key respectively.

In Windows I created this AutoHotkey script:
<br /> Browser_forward::End<br /> Browser_back::Home<br />
Much better!

Update: I added the same functionality to Linux by adding the following lines to the end of my ~/.Xmodmap file:
<br /> !! Remap Browser_Forward -> End and Browser_Back -> Home<br /> keycode 166 = Home NoSymbol Home<br /> keycode 167 = End NoSymbol End<br />
It’s OK to have duplicate keycode entries as long as the one that you want is listed last.

If you don’t have a .Xmodmap, generate it by running “xmodmap -pke > ~/.Xmodmap”. Finally make sure it gets loaded by adding this to your ~/.xinitrc file:

if [ -f $HOME/.Xmodmap ]; then
    /usr/bin/xmodmap $HOME/.Xmodmap

I found the exact keycode values for the Browser_Forward and Browser_Back keys by using sudo showkey. However, for some reason all the values returned were all off by -8. For example, in .Xmodmap the ‘A’ key should be 38 but running showkey returns 30.