Keyboard shortcut for touchpad

Hi, I suppose to have a key to enable/disable the touchpad, but it is not working (it should be Fn+F1), while others key do there job (like Fn+F3 to mute).

I thought to make a new shortcut, in Control Centre -> Keyboard Shortcuts; but I don’t know which command to use.

Any ideas?

I have an Entroware Orion Laptop, Ubuntu MATE 16.04
Thanks!!

Hi
Can you please test this command:

xinput --disable `xinput list | grep TouchPad | egrep -o id=..? | cut -d'=' -f2`

If it works and you need your touchpad again, use --enable switch.

Hi @ouroumov,
the command work, but how I can use it for creating a keyboard shortcut; I want to toggle between disable and enable quickly, don't mind if it is we two key shortcut (one for enable and one for disable). I use an external mouse, but sometimes I need to take the laptop elsewhere without the mouse.

I tried to put that command here:

But it didn't work. I don't think that it work like that, but I just tried.
How can I translate that command to Keyboard shortcut tool?

Thanks!

OK so, here's a script:

#! /bin/bash

T=`xinput list | grep -i TouchPad | egrep -o id=..? | cut -d'=' -f2`

CURRENT_STATE=`xinput list-props $T | grep "Device Enabled" | egrep -o "[0-9]$"`

if [ $CURRENT_STATE -eq "1" ]; then
    xinput --disable $T
else
    xinput --enable $T
fi

Save this into a file named for example toogle_touchpad.sh in your home folder in a sub folder named "bin" and make it executable using:

chmod +x ~/bin/toogle_touchpad.sh

Once that's done, head over to the keyboard shortcut preferences and add a new shortcut

Note that you have to use the full path to the file, including the /home/your_username part.

Then define the key combination you want:

And you should be good to go.

3 Likes

Thanks mate!!
that worked perfect.
:grin:

1 Like

I’m brand new to Ubuntu Mate (and am pretty new to Linux in general, having come over from Mint just yesterday) and am trying to get this to work. I believe I’ve followed all the steps outlined here to the letter, but I’m unable to get my touchpad to toggle on and off. I tried just this command to see if it would disable the touchpad but it does not appear to have an effect…

xinput --disable `xinput list | grep TouchPad | egrep -o id=..? | cut -d'=' -f2`

I had a keyboard shortcut working on Mint so I know it’s possible. Just need to get it working on this new system.

Is there another command anybody can suggest to see if I can find what will work and perhaps modify the above script?

Thank you in advance for any help you can offer.

–neal

Hi

Try:

grep -i TouchPad

If that doesn't work please provide the output of:

xinput list

ouroumov,

Thank you so much for offering to help with this.
I tried running the grep commands but I’m not sure I was doing it correctly (just entered them into a terminal). Nothing seemed to happen (please let me know if there’s something different I need to do with those). I also ran the “xinput list” command and it returned this…

nmboutin@nmboutin-Inspiron-3558:~$ xinput list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Microsoft Microsoft® Nano Transceiver v1.0	id=11	[slave  pointer  (2)]
⎜   ↳ Microsoft Microsoft® Nano Transceiver v1.0	id=12	[slave  pointer  (2)]
⎜   ↳ DLL06B0:00 06CB:78F1                    	id=14	[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)]
    ↳ Microsoft Microsoft® Nano Transceiver v1.0	id=10	[slave  keyboard (3)]
    ↳ Integrated_Webcam_HD                    	id=13	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=15	[slave  keyboard (3)]
    ↳ DELL Wireless hotkeys                   	id=17	[slave  keyboard (3)]
    ↳ Dell WMI hotkeys                        	id=18	[slave  keyboard (3)]

I hope there’s something in here that makes sense to you :^)

I’m not sure if this would be helpful, but I followed the following instructions to get this functionality to work when I was using Mint (in case this reveals something about what worked on this computer)…

  1. Go to the Keyboard settings (Menu>Preference>Keyboard) and select the “Keyboard Shortcut” tab
  2. Choose System>Hardware from the left panel
  3. Find the option called “Toggle touchpad state”. Click on it.
  4. Edit the second “keyboard bindings option” below it. (The first binding is something default like “XF86TouchpadToggle”, you can leave it as it is.) Assign a key combination.

I’ll also add that the built-in “disable touchpad while typing” doesn’t seem to work on this machine (again, hoping to offer a clue about this machine).

Hopefully there’s something useful here. If there’s any other info I can offer (I know… I’ve already offered more than requested), please let me know.

Thank you!

–neal

I wasn't expecting to get slapped so much in the face with Microsoft®.
Try and disable the stuff in the Virtual core pointer category (ids 11,12,14)

xinput --disable 11

And try and find out what stops working for each id, use --enable switch to roll back your changes.

LOL! I’m sorry mate. Let me take a step back and try the “xinput list” thing again with the wireless mouse transceiver removed (so sorry, I forgot it was plugged in there)…

nmboutin@nmboutin-Inspiron-3558:~$ xinput list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ DLL06B0:00 06CB:78F1                    	id=14	[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=13	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=15	[slave  keyboard (3)]
    ↳ DELL Wireless hotkeys                   	id=17	[slave  keyboard (3)]
    ↳ Dell WMI hotkeys                        	id=18	[slave  keyboard (3)]

I ran the “xinput --disable” command and the touchpad stopped when I disabled id 14 (nothing happened with ids 2 & 4). Turned it back on with the --enable switch. I think you’re on to something!

–neal

OK perfect, so we might be able to adapt for your hardware, please provide the output of:

xinput list-props 14

Sure thing. Oh my…

nmboutin@nmboutin-Inspiron-3558:~$ xinput list-props 14
Device 'DLL06B0:00 06CB:78F1':
	Device Enabled (140):	1
	Coordinate Transformation Matrix (142):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (267):	1
	Device Accel Constant Deceleration (268):	2.500000
	Device Accel Adaptive Deceleration (269):	1.000000
	Device Accel Velocity Scaling (270):	12.500000
	Synaptics Edges (296):	82, 1959, 67, 1174
	Synaptics Finger (297):	25, 30, 0
	Synaptics Tap Time (298):	180
	Synaptics Tap Move (299):	104
	Synaptics Tap Durations (300):	180, 100, 100
	Synaptics ClickPad (301):	1
	Synaptics Middle Button Timeout (302):	0
	Synaptics Two-Finger Pressure (303):	282
	Synaptics Two-Finger Width (304):	7
	Synaptics Scrolling Distance (305):	47, 47
	Synaptics Edge Scrolling (306):	0, 0, 0
	Synaptics Two-Finger Scrolling (307):	1, 0
	Synaptics Move Speed (308):	1.000000, 1.750000, 0.083857, 0.000000
	Synaptics Off (309):	1
	Synaptics Locked Drags (310):	0
	Synaptics Locked Drags Timeout (311):	5000
	Synaptics Tap Action (312):	2, 3, 0, 0, 1, 3, 2
	Synaptics Click Action (313):	1, 3, 2
	Synaptics Circular Scrolling (314):	0
	Synaptics Circular Scrolling Distance (315):	0.100000
	Synaptics Circular Scrolling Trigger (316):	0
	Synaptics Circular Pad (317):	0
	Synaptics Palm Detection (318):	0
	Synaptics Palm Dimensions (319):	10, 200
	Synaptics Coasting Speed (320):	20.000000, 50.000000
	Synaptics Pressure Motion (321):	30, 160
	Synaptics Pressure Motion Factor (322):	1.000000, 1.000000
	Synaptics Resolution Detect (323):	1
	Synaptics Grab Event Device (324):	0
	Synaptics Gestures (325):	1
	Synaptics Capabilities (326):	1, 0, 0, 1, 1, 1, 0
	Synaptics Pad Resolution (327):	19, 19
	Synaptics Area (328):	0, 0, 0, 0
	Synaptics Soft Button Areas (329):	1020, 0, 1016, 0, 0, 0, 0, 0
	Synaptics Noise Cancellation (330):	11, 11
	Device Product ID (258):	1739, 30961
	Device Node (259):	"/dev/input/event16"

–neal

So it looks like it’s the same convention “Device Enabled”.
I think the script would work for you if you just adapt it as follow:

#! /bin/bash

T=14

CURRENT_STATE=`xinput list-props $T | grep "Device Enabled" | egrep -o "[0-9]$"`

if [ $CURRENT_STATE -eq "1" ]; then
    xinput --disable $T
else
    xinput --enable $T
fi

Success! You are amazing. Thank you for sharing your time and knowledge to help me. The above script toggles the touchpad on this machine on/off perfectly.

–neal