Introduction

I just upgraded to a new Dell Precision Ubuntu-Based laptop from years of using a MacBook. Although for the mosts part, the transition was smooth, one thing frustrated me beyond anything else. The trackpad on the Dell is placed in a location where I constantly touch the trackpad causing my typing to insert in random locations as the mouse is moved.
This blog explains how I solved it.

Disable the trackpad

You can disable the trackpad in Ubuntu using the command xinput

First, you have to find out what device number your trackpad has been assigned. You can simply do this by entering:

$ xinput list
⎡ Virtual core pointer                     id=2 [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer               id=4 [slave  pointer  (2)]
⎜   ↳ AlpsPS/2 ALPS GlidePoint                 id=12 [slave  pointer  (2)]
⎣ Virtual core keyboard                    id=3 [master keyboard (2)]
    ↳ Virtual core XTEST keyboard              id=5 [slave  keyboard (3)]
    ↳ Power Button                             id=6 [slave  keyboard (3)]
    ↳ Video Bus                                id=7 [slave  keyboard (3)]
    ↳ Power Button                             id=8 [slave  keyboard (3)]
    ↳ Sleep Button                             id=9 [slave  keyboard (3)]
    ↳ Integrated_Webcam_HD                     id=10 [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard             id=11 [slave  keyboard (3)]
    ↳ DELL Wireless hotkeys                    id=13 [slave  keyboard (3)]
    ↳ Dell WMI hotkeys                         id=14 [slave  keyboard (3)]

As you can see above, in my case the touchpad is called AlpPS/2 APLS GlidePoint and it is assigned the id 12.

I can now disable the trackpad by simply typing:


$ xinput --disable 12

To enable the trackpad I can type:


$ xinput --enable 12

With this, I can enter longer edititing sessions with the trackpad disabled and the reneable it again when I need the mouse pointer. However, doing so from the command line is somewhat of a nuance as it requires extra keystrokes (I would have to Alt-Tab to the correct window and type the command).

Use AutoKey

AutoKey is a VERY useful tool that allows you to automate many of the tasks that you do (from typing to running complex scripts). You can find more information about AutoKey here.

To install autokey, look at these instructions

The cool thing about AutoKey is that you can assign an arbitrary Python program to run when you press some key combination.

To disable the trackpad I want to run the script:
system.exec_command("xinput --disable 12")

To reenable the trackpad, you would want to run this python script:
system.exec_command("xinput --enable 12")

Now, all you have to do is to pick a couple of key combinations that you don't use in your other programs. For me, I have assigned Ctrl-F5 and Alt-F5 as the keys to enable and disable the trackpad.

In AutoKey, simply assign this script snippet to the key of your choice. E.g.:

That's it. Now, whenever I want to type and disable the trackpad, I hit Alt-F5 (of course you can assign whatever code you want) and when I need my mouse, I'll reenable it by hitting Ctrl-F5.
0

Add a comment

About Me
About Me
Blog Archive
Subscribe
Subscribe
Links
Subscribe
Subscribe
Loading