Monday, May 18, 2015

Tweak your touchpad to taste in Linux

http://www.techrepublic.com/article/tweak-your-touchpad-to-taste-in-linux

If you've upgraded to the latest iteration of Ubuntu (or any distribution with a new kernel), you may have discovered your touchpad less than ideal. Jack Wallen has the fix.
Synclient
I few months ago, I added a Logitech T650 touchpad to my desktop setup. After a firmware update (one that had to be done via Windows--shame on you Logitech), the touchpad worked flawlessly under Ubuntu 14.10. Single-tap, double-tap, scrolling, and some gestures made my daily grind a little bit less, well, grindy.
But then I opted to make the leap to Ubuntu 15.04 and, out of nowhere, the touchpad wasn't working nearly as well. What happened? Oddly enough, the latest kernel finally received built-in support for touch devices. This means that users will no longer have to struggle to get those touchpads to work. However, this came at a cost. Out of the box, the touchpad is nowhere near efficient enough to work. It's slow, tapping doesn't always work as well, and scrolling isn't always what you'd hope it to be.
Thankfully, there's a way to adjust this. In fact, you can now adjust that touchpad to so perfectly fit your taste that you might wind up spending days dialing it to perfection. This tweaking is done via a command line tool called synclient. There is a GUI for the tool, called gpointing-device-settings, but it doesn't offer nearly as many options as the command line tool. The only caveat to using the command line tool is that there are so many options. For example:
  • LeftEdge=113
  • RightEdge=2719
  • TopEdge=127
  • BottomEdge=2237
  • FingerLow=2
  • FingerHigh=3
  • MaxTapTime=180
  • MaxTapMove=162
  • MaxDoubleTapTime=180
  • SingleTapTimeout=180
  • ClickTime=100
  • EmulateMidButtonTime=0
  • EmulateTwoFingerMinZ=56
  • EmulateTwoFingerMinW=7
Don't worry... many of those options you won't really touch. In fact, for average use, there are only a specific few that you'll have to bother with.
Speaking of which, how do you bother with them? Simple. You use the synclient command. With this command, you can adjust the sensitivity of every option (or enable/disable an option) on the fly. Say the cursor on your touchpad is too slow. You can adjust the minimum and maximum speed (both are important), from the command line like so:
synclient MinSpeed=1
synclient MaxSpeed=4
Those settings will immediately take effect.
The primary settings you'll want to focus on are:
  • FingerHigh--maximum amount of pressure required to register a tap
  • FingerLow--minimum amount of pressure required to register a tap
  • MaxSpeed--maximum speed of the cursor
  • MinSpeed--minimum speed of the cursor
  • AccelFactor--acceleration factor to get from MinSpeed to MaxSpeed
  • CoastingSpeed--how fast the pointer coasts to a stop
There are a ton of other options. Take a look at this page for a description of every available customization for synclient.

Creating a script

Like with most things Linux, if you want something to work outside of the standard, you can choose numerous routes to success. One such route is with a script. This is what I've done to make sure my fine-tuned touch settings always take effect upon rebooting or logging in.
Prior to doing this, you'll need to have played around with your synclient settings to get it exactly how you want it. Once you've done that, issue the command:
synclient -l > touchsettings
This will create a new file (called touchsettings) with all of your current synclient settings. The only problem with this file, is that each setting will be in the form:
MinSpeed = 1
You have to alter every line, in this newly created file, to look like:
synclient MinSpeed=1
At the beginning of the file, you also need to add the following line:
#!/bin/bash
See Figure A for a full example.
Figure A
Figure A
An example of the touchsettings file.
Save the file (we'll call it touchsettings) and give it executable permissions with the command:
chmod u+x touchsettings
You can run this single command to set all of your synclient settings. Now, all you have to do is go into the Startup Applications tool and add the touchsettings script to run at login (which startup applications tool will depend on your distribution). You might even want to move the touchsettings file into /usr/local/bin so the command can be run globally. If you do this, you'll also need to change the ownership of the command for the user, like so:
chown jlwallen.jlwallen /usr/local/bin/touchsettings
Now, you can run the command which touchsettings and see the script listed in /usr/local/bin.
It will take some time to get your touchpad tweaked to perfection. After a weekend of making slight adjustments, I managed to get my touchpad working exactly how I wanted it. It would be nice if the gpointing-devices-settings GUI would offer as much in the way of settings as the synclient command tool. Now that the latest kernel offers better support for such devices, I'm certain a solid GUI tool will come soon.
Do you prefer to tweak your desktops to perfection with GUI tools, command line tools, or a combination of both? Share your preference in the discussion thread below.

No comments:

Post a Comment