Skip to content

Instantly share code, notes, and snippets.

@grim13b
Created July 23, 2019 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grim13b/235ea2f0e3868973b64d48c290e0e4ff to your computer and use it in GitHub Desktop.
Save grim13b/235ea2f0e3868973b64d48c290e0e4ff to your computer and use it in GitHub Desktop.
タッチパットのON/OFFをトグル動作で制御する
#!/bin/bash
device_id=$( xinput | grep -i touchpad | sed -nre '/Touchpad/s/.*id=([0-9]*).*/\1/p' )
state=$( xinput list-props "$device_id" | grep -i "device enabled" | grep -o "[01]$" )
if test $state = '1'
then
xinput disable "$device_id" && notify-send -i input-touchpad "Toggle Touchpad" "Disabled"
else
xinput enable "$device_id" && notify-send -i input-touchpad "Toggle Touchpad" "Enabled"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment