Linux Lite Forums

Full Version: Item - Request - Touchpad disable script inclusion.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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.


The script does not require any outside system configuration other than being added to the script folder and a hot added to xfce4.
Which could be made update option.
https://github.com/sysdrum/rockerwell-pdr/
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
I built the script to work between Ubuntu/Linux Lite/arch/Fedora. So I wanted to limit the requirements so that I could use it as flexible as possible. I also wanted to keep the size super small. I strip the comments out and so that it is super small. For it to work it just uses just a if else.


Code:
#!/bin/bash## Language: bash# Last Change:04/08/15## This shell script enables/disables the touchpad on synaptics driver# Requires libnotify, xfce4-notifyd#if [ $(synclient -l | grep TouchpadOff | awk '{print $3}') == 1 ]; thensynclient TouchpadOff=0;notify-send "Touchpad enabled";elsesynclient TouchpadOff=1;notify-send "Touchpad disabled";#fi## A shortcut to this script can be assigned to enable Fn key functionality