Labels

lego (12) Linux (39) pi (20) Thinkpads (4)

Wednesday 4 December 2013

Living with a laptop without a trackpoint or without a middle mouse button [day 1 of 20-days-of-posts series]

I've been addicted to the trackpoint since I started using one in the '90s [I haven't owned or used a mouse on a regular basis since the '90s].  Truth be told, it wasn't even a IBM ThinkPad -- it was a business model HP Omnibook laptop.



If you haven't used one before, you probably wouldn't appreciate what you're missing.  If you are a ThinkPad enthusiast, you probably appreciate the advantages of a trackpoint -- how it allows you effortlessly move around the screen without taking your fingers off the keys or keyboard.

Even on my desktops, I've always used an equivalent USB keyboard with a trackpoint.


The trackpoint has been one of the many features of the ThinkPad that has kept me a consumer of the line over the years.  Even my Sony ultraportable P799 laptop has a trackpoint.




But there is still bound to be a time where I'll need to use a PC or laptop that doesn't have a trackpoint.  The trackpad has become the standard pointing device on almost all laptops and ultrabooks, and there doesn't exist a single ultrabook with a trackpoint.  Further, most trackpads don't feature the third mouse button that the ThinkPads have.  The third mouse button also has proven invaluable, making it critical for a "copy-and-paste" shortcut in Linux or in putty.  The only thing worse with coping with a laptop without a trackpoint is having to also deal without the middle mouse button.

In Linux, there are some options that don't involve using external devices or USB keyboards.  You can remap keyboard keys as mouse buttons.  I personally find I never use the right Alt, "menu" or right Ctrl keys.  The ideal solution, for me, would be to remap these buttons as mouse buttons (left, center, right). 



Not only does this allow provide you with your missing middle mouse button, but it also brings the buttons closer to your fingers since they are keys on the very same keyboard you have your hands positioned over.  Most trackpad buttons after all are located under the trackpad, which is generally the lower end of the bezel, requiring you to remove your hands from the keyboard to use.

With the keys remapped, you can keep your hands close the keyboard.  With this configuration, I typically will use either my thumb or forefinger to navigate the top edge of the trackpad to control the pointer, while I use the three remaining fingers to press the keys mapped to the mouse buttons.  It took me some getting used to, but then again, I never got used to the trackpad even after months of having to deal with one on an ultrabook.



The select-and-hold feels a little "left handed" in this configuration.  On a traditional trackpoint I use my thumb to hold and my forefinger to select, whereas in this configuration I use my thumb to select.

The solution can be adapted to your needs.  If you find it more natural, you can equally just as easy remap the left Ctrl, "Windows" and left Alt keys as moue buttons (left, middle, right).

Solution:

I've created a shell script that I've setup to start on login (in Debian/Ubuntu, can be a script listed in Startup Applications or call the script or commands from /etc/init.d/rc.local):
#! /bin/sh
setxkbmap -layout us
xkbset m
xkbset exp =m
xmodmap -e "keysym Alt_R = Pointer_Button1"
xmodmap -e "keysym Menu = Pointer_Button2"
xmodmap -e "keysym Control_R = Pointer_Button3"

setxkbmap sets the keyboard layout and should be pre-installed in most distributions.  xkbset lets you map mouse buttons to keyboard keys.  It isn't installed by default on most distributions, but is included with most distributions.  In Debian, it is a simple apt-get install xkbset.  xmodmap does the magic of mapping key functions, in this case to mouse buttons.

Pointer_Button1Pointer_Button2, and Pointer_Button3 represents the left, middle and right mouse buttons.  Alt_R,  Menu and Control_R represents the three keys I discussed earlier.

If the left side of the keyboard is more to your liking (for instance, if you are left handed), then you can use the keys Control_LWindows and Alt_L key names.

Obviously, the keys remapped will no longer function with their original programmed behaviour.  I found myself only using the left Alt and Ctrl keys, so I never missed the right key equivalents.

1 comment:

  1. IBM T430 has remapped the menu button as the Print Screen button good choice, but the placement of the page up, down , insert home and end keys leave much to be desired.

    ReplyDelete