Posts: 83
Threads: 8
Joined: Mar 2014
Reputation:
0
05-27-2015, 02:28 PM
(This post was last modified: 05-27-2015, 02:32 PM by sysdrum.)
I have a simple synaptic touchpad script that disables and re-enables the touchpad given a key press for those who would like to have more control when typing on some laptops. I would like to have it included in the scripts folder and maybe a note about it. I know that under the mouse and touchpad settings you can enable and disable plus set a delay when typing but sometimes that is not usable. For those using a usb mouse a quick key option would be nice so that they can turn it on and off without having to use the menu.
It is a simple yet nice feature that other distros don't have.
It is on my github.
I can post it here for review.
Posts: 688
Threads: 49
Joined: Jul 2014
Posts: 688
Threads: 49
Joined: Jul 2014
It's very similar to this script
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