系统相关
首页 > 系统相关> > Ubuntu set up 8 - shortcut for enable/disable touchpad

Ubuntu set up 8 - shortcut for enable/disable touchpad

作者:互联网

https://askubuntu.com/questions/844151/enable-disable-touchpad

 

I created this bash script from negusp's answer. It finds and toggles TouchPad device. You can configure a custom shortcut to it in system settings.

#!/bin/bash

read TPdevice <<< $( xinput | sed -nre '/TouchPad|Touchpad/s/.*id=([0-9]*).*/\1/p' )
state=$( xinput list-props "$TPdevice" | grep "Device Enabled" | grep -o "[01]$" )

if [ "$state" -eq '1' ];then
    xinput --disable "$TPdevice" && notify-send -i emblem-nowrite "Touchpad" "Disabled"
else
    xinput --enable "$TPdevice" && notify-send -i input-touchpad "Touchpad" "Enabled"
fi

I'm setting Ctrl+Shift+F9 for toggle touchpad enable and disable like this:

enter image description here

Update: You may need to make your script to executable with command chmod +x filename or input /bin/bash /filepath to Command field of Custom shortcut window.

标签:bin,enable,set,up,shortcut,touchpad,disable,bash
来源: https://www.cnblogs.com/imoon22/p/14223172.html