disable touchpad

Randy Dunlap rdunlap at infradead.org
Fri Mar 27 19:23:16 CET 2020


On 3/27/20 12:29 AM, Johannes Lips wrote:
> On 27/03/2020 07:42, Randy Dunlap wrote:
>> Hi,
>>
>> I want to disable the touchpad on my laptop.
>> The laptop is a Toshiba Portege and the toshiba_acpi driver
>> recognizes the laptop and reports that it has the following
>> capabilities:
>>
>> [   24.392059] toshiba_acpi: Toshiba Laptop ACPI Extras version 0.24
>> [   24.472292] toshiba_acpi: Supported laptop features: hotkeys video-out fan touchpad accelerometer-axes usb-sleep-charge panel-power-on cooling-method
>>
>>
>> When I press Fn + F9 (touchpad on/off toggle), the keycode
>> is recognized AFAICT.  evtest reports:
>>
>> Event: time 1584932366.360765, -------------- SYN_REPORT ------------
>> Event: time 1584932366.600689, type 4 (EV_MSC), code 4 (MSC_SCAN), value 143
>> Event: time 1584932366.600689, type 1 (EV_KEY), code 530 (KEY_TOUCHPAD_TOGGLE), value 1
>>
>>
>> Is there a way to configure xfce4 to recognize that keycode
>> and disable/enable the touchpad?
> Hi Randy,
> 
> I am using the following small script in connection with Xfconf to disable or enable the touchpad and trackstick depending if there's an external mouse.
> It works really nice, when run at startup and I also put it into /usr/local/bin so that whenever I need to enable/disable it on the move I just call that command and am good to go.
> 
> Hope this helps
> Johannes

Hi Johannes,

That looks great except for one thing: I don't see any pointers listed
when I run 'xfconf-query -c' (no "pointers" channel) and
'xfconf-query -c pointers -l' lists nothing at all.

That was a bit confusing.  But I just assumed that the script works,
and I used xfce "Mouse and Touchpad" settings to find the device name
(generic "SynPS/2 Synaptics TouchPad").  Then I replaced your device
name with my device name, deleted the "stick" lines in the script
since I don't have a stick, changed the "-eq 2" to "-eq 1", and
tested it.  Disabling the touchpad worked (i.e., set the property
value to 0).  Enabling the touchpad did not work, because the
count of "mouse" devices was still 2 and the script wanted to
disable the property again.  So I made the enable/disable value
an optional argument to the script and it is now working.

Much thanks for your help and script.

It would still be nice to be able to connect the Toshiba laptop
function key (hot key) to this kind of action since there are
keycodes defined for ON, OFF, and TOGGLE:

#define KEY_TOUCHPAD_TOGGLE	0x212	/* Request switch touchpad on or off */
#define KEY_TOUCHPAD_ON		0x213
#define KEY_TOUCHPAD_OFF	0x214


Anyway, the script is now working for me. (attached)

-- 
~Randy

-------------- next part --------------
#!/bin/sh

val=$1

# disable touchpad when mouse is connected during startup

if [ `ls /dev/input | grep -c mouse` -gt 1 ]; then
	##echo "1"
	if [ "$val" = "" ]; then
		val=0
	fi
        xfconf-query -c pointers  -p /SynPS2_Synaptics_TouchPad/Properties/Device_Enabled -s $val
fi

if [ `ls /dev/input | grep -c mouse` -eq 1 ]; then
        ##echo "2"
	if [ "$val" = "" ]; then
		val=1
	fi
  	xfconf-query -c pointers  -p /SynPS2_Synaptics_TouchPad/Properties/Device_Enabled -s $val
  fi


More information about the Xfce mailing list