安装
安装必要的函数库和驱动程序
$ sudo pacman -S libinput xf86-input-libinput xorg-xinput
编写Shell脚本
$ vim DisableTouchpad.sh
#!/bin/bash
declare -i ID
ID=`xinput list | grep -Eio '(touchpad|glidepoint)\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
declare -i STATE
STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
if [ $STATE -eq 1 ]
then
xinput disable $ID
else
xinput enable $ID
fi
赋予脚本读/写/执行权限
$ sudo chmod 0755 DisableTouchpad.sh
Systemd 自启动
$ cd /usr/lib/systemd/system
# 创建Systemd服务
$ sudo vim touchpad.service
[Unit]
Description=Touchpad control service
[Service]
Type=oneshot
ExecStart=/File/Self-starting/DisableTouchpad.sh
[Install]
WantedBy=multi-user.target
配置touchpad
服务自启动
$ systemctl enable touchpad
