Last active
March 20, 2018 21:18
-
-
Save jasonrobot/5bec9c99e3d4e8255af5abecfe51ea91 to your computer and use it in GitHub Desktop.
toggles the synaptics touchpad on and off, or you can specify on and off
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
#!/usr/bin/env fish | |
# Usage: | |
# run with no args to toggle between on and off | |
# pass a single arg "on" or "off" to do exactly what you'd expect | |
# drop it in ~/bin with a nice name (I have ~/bin/tp) or bind it to a hotkey or something like that | |
function turn-on | |
echo "turning on" | |
synclient touchpadoff=0 | |
end | |
function turn-off | |
echo "turning off" | |
synclient touchpadoff=1 | |
end | |
if test (count $argv) -eq 0 | |
set -l current (synclient | grep -i touchpadoff | awk "{print \$3}") | |
if test $current -eq 0 | |
turn-off | |
else | |
turn-on | |
end | |
else | |
if test $argv = "on" | |
turn-on | |
else if test $argv = "off" | |
turn-off | |
else | |
echo "Invalid argument: " $argv | |
end | |
end |
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
#!/usr/bin/env bash | |
# Usage: | |
# run with no args to toggle between on and off | |
# pass a single arg "on" or "off" to do exactly what you'd expect | |
# drop it in ~/bin with a nice name (I have ~/bin/tp) or bind it to a hotkey or something like that | |
if test -z $@ | |
then | |
echo "no args, toggling" | |
current=`synclient | grep -i touchpadoff | awk "{print \\$3}"` | |
if test $current = 0 | |
then | |
echo "turning off" | |
synclient touchpadoff=1 | |
else | |
echo "turning on" | |
synclient touchpadoff=0 | |
fi | |
else | |
if test $@ = "on" | |
then | |
echo "turning on" | |
synclient touchpadoff=0 | |
elif test $@ = "off" | |
then | |
echo "turning off" | |
synclient touchpadoff=1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment