Recently I’ve been busy learning the esoteric editor called Vim and figured out my laptop’s touchpad is causing nuisance when you’re working with the keyboard only—which is the whole point of using Vim. At the same time, some programs are nearly unusable without the mouse. In other words, I wanted to be able to switch the touchpad on and off—with the keyboard, of course.
Some laptops have a special key combination for it, but my Dell XPS 13” doesn’t. Ubuntu also provides a switch in the Control Center, but it’s hardly reachable without the mouse:
So I wrote this script, which toggles the touchpad every time you run it. You can assign it to a desired key combination using the same Control Center, for example, I’ve linked it to Fn+T.
The script makes use of the standard X11 utility
xinput. You can find it in my yktools repository under the logical name
touchpad-toggle. Once run, it’ll display a standard desktop notification about the current state of the touchpad:
The script’s source code is available on GitHub. It scans the list of input devices, picks the first one having
touchpad in its name, and toggles its state. ■