05-28-2015, 02:40 PM
It's very similar to this script
https://help.ubuntu.com/community/Synapt...ash_Script
I like your idea on notify-send
xinput version here
https://help.ubuntu.com/community/Synapt...ash_Script
I like your idea on notify-send
Code:
#!/bin/bash
# toggle synaptic touchpad on/off
# get current state
SYNSTATE=$(synclient -l | grep TouchpadOff | awk '{ print $3 }')
# change to other state
if [ $SYNSTATE = 0 ]; then
synclient touchpadoff=1
notify-send "Touchpad disabled";
elif [ $SYNSTATE = 1 ]; then
synclient touchpadoff=0
notify-send "Touchpad enabled";
else
notify-send "Couldn't get touchpad status from synclient"
exit 1
fi
exit 0
xinput version here
Code:
#!/bin/bash
# tp_toggle
#
# Toggle the touchpad on/off.
# Get the id number of the touchpad.
tp_id=`xinput list | grep -i touchpad | awk '{ print $6 }' | sed 's/id=//'`
# Find out whether the touchpad is enabled or not.
tp_enabled=`xinput list-props $tp_id | grep Device\ Enabled | awk '{ print $4 }'`
if [ $tp_enabled = 0 ]
then
# The touchpad is currently disabled, so turn it on.
xinput set-prop $tp_id "Device Enabled" 1
notify-send "Touchpad enabled";
elif [ $tp_enabled = 1 ]
then
# The touchpad is currently enabled, so turn it off.
xinput set-prop $tp_id "Device Enabled" 0
notify-send "Touchpad disabled";
else
notify-send "tp_toggle: Could not get touchpad status from xinput."
exit 1
fi