Guest User

Untitled

a guest
Jul 13th, 2020
296
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # Version 0.1 Tuesday, 07 May 2013
  3. # Comments and complaints http://www.nicknorton.net
  4. # GUI for mouse wheel speed using imwheel in Gnome
  5. # imwheel needs to be installed for this script to work
  6. # sudo apt-get install imwheel
  7. # Pretty much hard wired to only use a mouse with
  8. # left, right and wheel in the middle.
  9. # If you have a mouse with complications or special needs,
  10. # use the command xev to find what your wheel does.
  11. #
  12. ### see if imwheel config exists, if not create it ###
  13. if [ ! -f ~/.imwheelrc ]
  14. then
  15.  
  16. cat >~/.imwheelrc<<EOF
  17. ".*"
  18. None, Up, Button4, 1
  19. None, Down, Button5, 1
  20. Control_L, Up, Control_L|Button4
  21. Control_L, Down, Control_L|Button5
  22. Shift_L, Up, Shift_L|Button4
  23. Shift_L, Down, Shift_L|Button5
  24. EOF
  25.  
  26. fi
  27. ##########################################################
  28.  
  29. CURRENT_VALUE=$(awk -F 'Button4,' '{print $2}' ~/.imwheelrc)
  30.  
  31. NEW_VALUE=$(zenity --scale --window-icon=info --ok-label=Apply --title="Wheelies" --text "Mouse wheel speed:" --min-value=1 --max-value=100 --value="$CURRENT_VALUE" --step 1)
  32.  
  33. if [ "$NEW_VALUE" == "" ];
  34. then exit 0
  35. fi
  36.  
  37. sed -i "s/\($TARGET_KEY *Button4, *\).*/\1$NEW_VALUE/" ~/.imwheelrc # find the string Button4, and write new value.
  38. sed -i "s/\($TARGET_KEY *Button5, *\).*/\1$NEW_VALUE/" ~/.imwheelrc # find the string Button5, and write new value.
  39.  
  40. cat ~/.imwheelrc
  41. imwheel -kill
RAW Paste Data