[Tutorial] Disabling a laptop trackpad in Xfce

Questions about hardware, drivers and peripherals
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
revian

[Tutorial] Disabling a laptop trackpad in Xfce

Post by revian »

I use Linux Mint 18.2 and recently switched from Cinnamon to Xfce on my Dell Inspiron laptop. Everything was going well except for one minor issue; accidentally touching the touchpad while typing caused the cursor to move and this action was interrupting my typing. This post will document how I was able to toggle the touchpad functionality as needed.

Note: This tutorial works for the Xfce edition of Linux Mint and should not be relied upon for use with other desktop environments.

The problem: Accidentally brushing the touchpad on a laptop will cause the mouse pointer to re-focus to another area of the screen. If you’re typing when this happens, the text will be either placed in the wrong location or interrupted entirely.

The solution: Disable the laptop touchpad while typing.

Many desktop environments include a feature to turn the touchpad off while typing – Xfce includes this feature but it doesn’t work as expected. In order to make this feature work properly, I had to completely disable the touchpad.

Step 1: identify the touchpad device

The first thing we need to do is identify the device we will be working with and you can do that in XFCE by opening a terminal and running the following command:

Code: Select all

xinput list
Xinput is a utility to list available input devices, query information about a device and change input device settings. The output from the above command listed my touchpad as id=14 but yours will likely have a different number. Armed with this information, it was a simple matter of using xinput to disable the device as needed.

Step 2: disabling the device

Using the xinput command again, I ran the following command:

Code: Select all

xinput set-prop 14 "Device Enabled" 0
The number “14” is the device id for my touchpad, you’ll need to replace the number I used above with the number of your device.

After setting the “Device Enabled” state to “0”, the off state, I tried moving the mouse pointer using the touchpad and, sure enough, the mouse pointer didn’t move. So, I re-enabled the touchpad by running the following command:

Code: Select all

xinput set-prop 14 "Device Enabled" 1
Again, the number “14” is the device id for my touchpad, you’ll need to replace the number I used above with the number of your device.

Setting the “Device Enabled” state back to “1”, the on state, restored the functionality of the touchpad as expected. You can add those two commands to your ~/.bash_aliases file and run them at your leisure, but I went a step further and created keyboard shortcuts for the commands.

Using keyboard shortcuts to toggle touchpad functionality

Now that we have the proper commands to toggle the touchpad at our leisure, we can use those commands to create keyboard shortcuts.

Open the Settings app and click on the Keyboard icon in the Hardware section, we’re going to add two new commands. In the Keyboard settings window, click on the tab entitled Application Shortcuts. At the bottom of the Application Shortcuts tab click the button labeled “Add”. Enter the command below and click the OK button:

Code: Select all

xinput set-prop 14 "Device Enabled" 0
Click the Add button a second time, enter the command below and click the OK button:

Code: Select all

xinput set-prop 14 "Device Enabled" 1
One last time. The number “14” is the device id for my touchpad, you’ll need to replace the number I used above with the number of your device.

You should now see two new commands entered into the shortcuts list. Double-click each of those new commands and give them your preferred key sequence. I used Ctrl+Alt+0 for off and Ctrl+Alt+1 for on – it made sense to use “0” and “1” as those numbers are the binary equivalent of off and on. All you have to do now is perform the proper keyboard shortcuts to disable the touchpad when you want to type, or plug in a usb mouse, and then re-enable the touchpad when you want to use it.

You should now have keyboard shortcuts which will turn the touchpad off and on whenever the need arises.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Locked

Return to “Hardware Support”