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:

Ubuntu set up 8 - shortcut for enable/disable touchpad

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.

上一篇:javascript – 在textarea字段中使用“tabs”


下一篇:[IOI2016]shortcut 题解