In setting up a laptop -- Debian "Squeeze" with a Gnome 2 desktop -- for an invalid who will be doing most of her computing from bed, we hit a snag. Two snags, actually: both related to the switching between the trackpad and an external trackball.
Disabling and re-enabling the trackpad
First, the trackpad gets in the way when she's typing. "Disable touchpad while typing" was already set, but it doesn't actually work -- the mouse was always moving when her palm brushed against it.
On her desktop computer, she's always used a Logitech trackball -- never really got the hang of mice, but that trackball always worked well for her. And fortunately, unlike a mouse, a trackball works just fine from bed.
Once the trackball is working, there's really no need to have the trackpad enabled. So why not just turn it off when the external trackball is there? I thought I'd once seen a preference like that ... but it was nowhere to be found in the Gnome 2 desktop.
It turns out the easiest way to disable a trackpad is this:
Using 0 instead of 1 turns it back on. So we gave her shell aliases for both these commands. A web search will show various approaches to writing udev rules to run something like that automatically, but she felt it was easy enough to type a command when she switches modes, so we're going with that for now.
Emulate the middle button on an external mouse or trackball
We thought we were done -- until we tried to paste that alias into her shell and discovered that 2-button paste doesn't work for external mice in Squeeze.
Usually, when you have a mouse-like device that has only two buttons, you can click the left and right buttons together to emulate a middle click. She'd been using that on her old Ubuntu Lucid install, and it works on pretty much every trackpad I've used. But it didn't work with the USB trackball on Squeeze.
Gnome used to have a preference for middle button emulation, but it's gone now. There's a program you can install called gpointing-device-settings that offers a 2-button emulation setting ... but it doesn't save the settings anywhere. And since it's a GUI program you can't make it part of your login or boot process -- you'd have to go through and click to set it every time. Not happening.
2-buttom emulation is an X setting -- one of the settings that used to be specified in Xorg.conf, and now wanders around to different places on every distro. A little web searching didn't turn up a likely candidate for Squeeze, but it did turn up a way that's probably more distro independent: the xinput command.
After installing xinput, you need the X ID of the external mouse or trackball.
should show you something like this (plus more stuff for keyboards
and possibly other devices):
$ xinput list Virtual core pointer id=2 [master pointer (3)] Virtual core XTEST pointer id=4 [slave pointer (2)] SynPS/2 Synaptics TouchPad id=10 [slave pointer (2)] Kensington Kensington USB/PS2 Orbit id=13 [slave pointer (2)]
Once you have the id of the external device, list its properties:
$ xinput list-props 13 ~ 9:01PM Device 'Kensington Kensington USB/PS2 Orbit': Device Enabled (132): 1 ... long list of other properties ... Evdev Middle Button Emulation (303): 0 Evdev Middle Button Timeout (304): 50 ... more properties ...
You can see that middle button emulation is disabled (0). So turn it on:
$ xinput --set-prop 13 "Evdev Middle Button Emulation" 1
Click both buttons together, and sure enough -- a middle button paste! I added that to the alias that turns the trackpad off -- though of course, it could also be added to a udev rule that fires automatically when the mouse is plugged in.
[ 15:34 Sep 08, 2012 More linux/install | permalink to this entry | ]