metalx1000

Toggle Touchpad

May 4th, 2021
850
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2021  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #This program is free software: you can redistribute it and/or modify
  7. #it under the terms of the GNU General Public License as published by
  8. #the Free Software Foundation, either version 3 of the License, or
  9. #(at your option) any later version.
  10.  
  11. #This program is distributed in the hope that it will be useful,
  12. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. #GNU General Public License for more details.
  15.  
  16. #You should have received a copy of the GNU General Public License
  17. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18. ######################################################################
  19.  
  20. device="TM3276-022"
  21. id="$(xinput|grep ${device}|cut -d\= -f2|awk '{print $1}')"
  22. echo "$id"
  23.  
  24. state="$(xinput --list-props 12|grep Enable|awk '{print $4}')"
  25. if [[ $state == 1 ]]
  26. then
  27.   xinput --disable $id
  28.   echo "$device disabled"
  29. elif [[ $state == 0 ]]
  30. then
  31.   xinput --enable $id
  32.   echo "$device enabled"
  33. else
  34.   echo "error."
  35. fi
  36.  
RAW Paste Data