Skip to content

Instantly share code, notes, and snippets.

@dyllandry
Last active April 22, 2020 01:27
Show Gist options
  • Select an option

  • Save dyllandry/d7f7ba2b88807cb107c5fc608d3fe5ac to your computer and use it in GitHub Desktop.

Select an option

Save dyllandry/d7f7ba2b88807cb107c5fc608d3fe5ac to your computer and use it in GitHub Desktop.
Toggle a touchpad on/off.
#!/bin/sh
# Toggles a touchpad on/off.
# Might only work computers that use xinput.
DEVICE_NAME="SynPS/2 Synaptics TouchPad"
ID=$(xinput list --id-only "$DEVICE_NAME")
IS_ENABLED=$(xinput --list-props "$DEVICE_NAME" | grep "Device Enabled" | grep -o "[01]$")
if [ $IS_ENABLED -eq 0 ]; then
xinput set-prop $ID "Device Enabled" 1
echo "touchpad on"
else
xinput set-prop $ID "Device Enabled" 0
echo "touchpad off"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment