Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.98 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. #
  3. # Toggle touchpad on and off
  4. #
  5. # Author: Heath Thompson
  6. # Email:  Heath.Thompson@gmail.com
  7. #
  8. # For startup wait for desktop to load first.
  9. while true
  10. do
  11.     if [ $(pgrep gnome-panel) == "" ] ; then
  12.         echo 'X loaded'
  13.         break
  14.     else
  15.         echo 'X not loaded, waiting...'
  16.         sleep 5
  17.     fi
  18. done
  19. #
  20. # Check to see if appletouch is running
  21. # if lsmod | grep appletouch > /dev/null;
  22. # then
  23. #   echo " * Appletouch enabled";
  24. # else
  25. #   echo " * Appletouch either not working or not installed"
  26. #   killall mouseSwitcher
  27. # fi
  28.  
  29. while true
  30. do
  31.     # 'xinput list' will list all input devices x detects
  32.     # I could reference my usb mouse by ID but I'm afraid that if I plug
  33.     # another device in before my mouse, it might not have the same ID each
  34.     # time.  So using the device name makes it relatively fail-safe.
  35.     if [ ! $(xinput list 'Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)') == "" ] ; then
  36.         # Found my usb wireless mouse
  37.         # Disable everything on the Touchpad and turn it off
  38.         synclient TouchpadOff=1 MaxTapTime=0 ClickFinger1=0 ClickFinger2=0 ClickFinger3=0
  39.         # Ends all syndaemon capturing which may have been used to monitor the touchpad/keyboard activity
  40.         killall syndaemon
  41.     else
  42.         # My usb wireless mouse isn't present we need the touchpad
  43.         # Reenable Touchpad and configure pad-clicks
  44.         # RTCornerButton is the Right Top Corner on the touchpad
  45.         #   The value 3 maps it as the right click button
  46.         # RBCornerButton is the Right Bottom Corner on the touchpad
  47.         #   The value 2 maps it as the middle click button
  48.         synclient TouchpadOff=0 MaxTapTime=150 ClickFinger1=1 ClickFinger2=2 ClickFinger3=3 RTCornerButton=3 RBCornerButton=2
  49.         # Forces break of touchpad functions while typing if the touchpad is enabled.
  50.         # Adds a 3 second interval following keyboard use which helps to prevent the
  51.         # mouse from jumping while typing & resting hands on restpad or the touchpad
  52.         syndaemon -i 3 -d
  53.     fi
  54.    
  55.     # wait 2 seconds and poll the mouse state again
  56.     sleep 2
  57. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement