Advertisement
Guest User

Untitled

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