Add a script that toggles touchpad on/off

This commit is contained in:
Doncho N. Gunchev 2020-10-11 23:48:47 +03:00
parent 3c0df507d7
commit c10a762664

24
touchpad_toggle Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
# https://wiki.archlinux.org/index.php/Touchpad_Synaptics#Synclient
declare -i ID
ID=$(xinput list | grep -iEo 'Touchpad\s*id\=[0-9]{1,4}' | grep -Eo '[0-9]{1,4}')
declare -i STATE
STATE=$(xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}')
if [ $STATE -eq 1 ]
then
xinput disable $ID
# echo "Touchpad disabled."
notify-send --urgency=critical --expire-time=2000 --app-name=TouchPad \
--icon='/usr/share/icons/HighContrast/48x48/devices/input-touchpad.png' \
'Touchpad' "Disabled $ID"
else
xinput enable $ID
# echo "Touchpad enabled."
#notify-send -t 1500 -u critical 'Touchpad' 'Enabled' -i /usr/share/icons/HighContrast/48x48/devices/input-touchpad.png
notify-send --urgency=normal --expire-time=2000 --app-name=TouchPad \
--icon='/usr/share/icons/HighContrast/48x48/devices/input-touchpad.png' \
'Touchpad' "Enabled $ID"
fi