Enable/Disable Touchpad on HP Envy Ultrabook running Ubuntu

HP Envy Touchpad

HP Envy Touchpad

As mentioned in a previous post, I mentioned about my HP Envy and Ubuntu. One more feature I noticed missing was the ability to enable and disable the touchpad. As shown in the picture, the touchpad has a special tap area on its left top corner which acts as a toggle button. But this is not working under Ubuntu. But ofcourse I had to solve this problem and here is the solution I came up with:

First of all we need to list all the input devices available. This can be done by the command:

xinput list


⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Logitech USB Receiver                   	id=9	[slave  pointer  (2)]
⎜   ↳ Logitech USB Receiver                   	id=10	[slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad              	id=13	[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)]
    ↳ HP Truevision HD                        	id=11	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=12	[slave  keyboard (3)]
    ↳ HP WMI hotkeys                          	id=14	[slave  keyboard (3)]

Notice the 4th entry under Virtual core pointer which is SynPS/2 Synaptics TouchPad having id=13. To be very sure we can also test it using the command:

xinput test 13

As I move my finger on the touchpad, the data is displayed which is a surety that I made the right choice. Now we need to create a script to enable/disable the touchpad.

Create a new file for instance toggle and place it in the current folder. Add the following contents to this file:

SYNSTATE=$(xinput list-props "13" | grep Enabled | grep -Eo '.$')
if [ $SYNSTATE = 0 ]; then xinput set-prop "13" "Device Enabled" 1
else xinput set-prop "13" "Device Enabled" 0; fi

Notice the “13” in all three lines, this is the id which we noticed earlier. Save and close the file. To run this script, we need to change the permissions to executable:

chmod +x toggle

Finally we can enable and disable the touchpad:


Running this command will disable it, which you can test also. Running it again will enable it again. This is enough and works fine. However you will notice that these id numbers at times do change on different system boots. The solution can be to use the complete name its of the id in the script:

SYNSTATE=$(xinput list-props "SynPS/2 Synaptics TouchPad" | grep Enabled | grep -Eo '.$')
if [ $SYNSTATE = 0 ]; then xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1
else xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0; fi
Ubuntu Keyboard

Ubuntu Keyboard

As an additional step, we can also assign a keyboard shortcut for this file. Open the Keyboard program from Unity dash and go to the second tab named Shortcuts. Add a new shortcut as shown in the picture. Give a name, path of the file and a key combination.

Now pressing these keys will toggle the touchpad 🙂


4 thoughts on “Enable/Disable Touchpad on HP Envy Ultrabook running Ubuntu

    • Extension is irrelevant. I didn’t give any. What matters is that you make it executable as mentioned in the post

  1. thank you for the help. do you have any idea how to get ubunutu to read the ati graphics card (i think it is 8700M) – as it is using the default intel card on the motherboard. And how to configure the switchable graphics. Any help in this regard or pointing me in the right direction would be very helpful. Thank you

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s