Last active
December 4, 2015 17:30
-
-
Save john-e/928e9fbff3f00f8a1666 to your computer and use it in GitHub Desktop.
script to enable/disable touchpad, can be attached to keyboard shortcut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# disable/enable touchpad | |
# working for Ubuntu 14.04 on Dell 3000/Lenovo G50-80 | |
# @author Engit | |
status=$(synclient -l | grep TouchpadOff | awk '{print $3}') | |
#if synclient returns nothing use xinput | |
synclient=1 | |
if [ -z $status ]; then | |
synclient=0 | |
echo 'Working with xinput...' | |
id=$(xinput | grep -i touchpad | awk '{print $6}' | sed 's/.*id=\([0-9]*\).*/\1/'); | |
status=$(xinput list-props $id | grep Enabled | awk '{print $4}'); | |
fi | |
message='' | |
if [ $status -eq 1 ];then | |
status=0 | |
message="Disabled" | |
if [ $synclient -eq 1 ];then | |
message="Enabled" | |
fi | |
else | |
status=1 | |
message="Enabled" | |
if [ $synclient -eq 1 ];then | |
message="Disabled" | |
fi | |
fi | |
killall notify-osd | |
if [ $synclient -eq 1 ];then | |
synclient TouchpadOff=$status | |
else | |
xinput set-prop $id "Device Enabled" $status | |
fi | |
notify-send -u critical -t 50 "Trackpad" $message | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment