2 # Released under the GPL
3 # Nub-Settings, v1.1, written by Michael Mrozek aka EvilDragon 2010
4 # This scripts allows you to configure all parameters of the Pandora-Nubs. The left and right nub can both be configured individually.
6 while mainsel=$(zenity --title="Nub-Configuration" --width="380" --height="200" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "leftnub" "Configure left nub" "rightnub" "Configure right nub" "default" "Restore default settings for both nubs"); do
11 while leftsel=$(zenity --title="Configure Left Nub" --width="430" --height="300" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "nub0mode" "Change Nub mode" "nub0msense" "Change the mouse speed" "nub0ssense" "Change the scroll sensitivity" "nub0rate" "Change the scroll speed" "nub0thres" "Change the mouse button sensitivity" "nub0reset" "Reset Nub"); do
15 if nubm=$(zenity --height=300 --list --title="Select Nub-mode for the left nub" --text="Please select the mode for the left nub.\n\nNote: This can affect running programs.\nSome programs also may change the nub mode themselves." --column "return" --hide-column=1 --column "Nub Mode" "mouse" "Use the nub as mouse" "mbuttons" "Use the nub for mousebuttons" "scroll" "Use the nub for scrolling" "absolute" "Use the nub as joystick") ; then
17 echo $nubm > /proc/pandora/nub0/mode
21 curmsense=$(cat /proc/pandora/nub0/mouse_sensitivity)
22 newmsense=$(zenity --scale --text "Set speed for left nub mouse.\nThe default value is 150. Higher value means faster mouse." --min-value=50 --max-value=300 --value=$curmsense --step 1)
23 echo $newmsense > /proc/pandora/nub0/mouse_sensitivity
27 curssense=$(cat /proc/pandora/nub0/scrollx_sensitivity)
28 newssense=$(zenity --scale --text "Set the scroll sensitivity for the left nub for the X-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1)
29 echo $newssense > /proc/pandora/nub0/scrollx_sensitivity
30 curssense=$(cat /proc/pandora/nub0/scrolly_sensitivity)
31 newssense=$(zenity --scale --text "Set the scroll sensitivity for the left nub for the Y-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1)
32 echo $newssense > /proc/pandora/nub0/scrolly_sensitivity
36 currate=$(cat /proc/pandora/nub0/scroll_rate)
37 newrate=$(zenity --scale --text "Set the scroll speed for the left nub.\nThe default value is 20. Higher value means more sensitive." --min-value=1 --max-value=40 --value=$currate --step 1)
38 echo $newrate > /proc/pandora/nub0/scroll_rate
42 curthres=$(cat /proc/pandora/nub0/mbutton_threshold)
43 newthres=$(zenity --scale --text "Change the mousebutton sensitivity for the left nub.\nThe default value is 20.\nThe higher the value the higher you need to move the nub" --min-value=1 --max-value=40 --value=$curthres --step 1)
44 echo $newthres > /proc/pandora/nub0/mbutton_threshold
48 echo 1 > /sys/bus/i2c/drivers/vsense/3-0066/reset
50 echo 0 > /sys/bus/i2c/drivers/vsense/3-0066/reset
51 curmode=$(cat /proc/pandora/nub0/mode)
52 echo mouse > /proc/pandora/nub0/mode
53 while ! zenity --question --title="Resetted left nub" --text="The left nub has been resetted.\nPlease try to move the mouse cursor\nto test if it is working properly." --ok-label="Working properly" --cancel-label="Reset again"; do
54 echo 1 > /sys/bus/i2c/drivers/vsense/3-0066/reset
56 echo 0 > /sys/bus/i2c/drivers/vsense/3-0066/reset
58 echo $curmode > /proc/pandora/nub0/mode
66 while rightsel=$(zenity --title="Configure Right Nub" --width="430" --height="300" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "nub1mode" "Change Nub mode" "nub1msense" "Change the mouse speed" "nub1ssense" "Change the scroll sensitivity" "nub1rate" "Change the scroll speed" "nub1thres" "Change the mouse button sensitivity" "nub1reset" "Reset Nub"); do
70 if nubm=$(zenity --height=300 --list --title="Select Nub-mode for the right nub" --text="Please select the mode for the right nub.\n\nNote: This can affect running programs.\nSome programs also may change the nub mode themselves." --column "return" --hide-column=1 --column "Nub Mode" "mouse" "Use the nub as mouse" "mbuttons" "Use the nub for mousebuttons" "scroll" "Use the nub for scrolling" "absolute" "Use the nub as joystick") ; then
72 echo $nubm > /proc/pandora/nub1/mode
76 curmsense=$(cat /proc/pandora/nub1/mouse_sensitivity)
77 newmsense=$(zenity --scale --text "Set speed for right nub mouse.\nThe default value is 150. Higher value means faster mouse." --min-value=50 --max-value=300 --value=$curmsense --step 1)
78 echo $newmsense > /proc/pandora/nub1/mouse_sensitivity
82 curssense=$(cat /proc/pandora/nub1/scrollx_sensitivity)
83 newssense=$(zenity --scale --text "Set the scroll sensitivity for the right nub for the X-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1)
84 echo $newssense > /proc/pandora/nub1/scrollx_sensitivity
85 curssense=$(cat /proc/pandora/nub1/scrolly_sensitivity)
86 newssense=$(zenity --scale --text "Set the scroll sensitivity for the right nub for the Y-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1)
87 echo $newssense > /proc/pandora/nub1/scrolly_sensitivity
91 currate=$(cat /proc/pandora/nub1/scroll_rate)
92 newrate=$(zenity --scale --text "Set the scroll speed for the right nub.\nThe default value is 20. Higher value means more sensitive." --min-value=1 --max-value=40 --value=$currate --step 1)
93 echo $newrate > /proc/pandora/nub1/scroll_rate
97 curthres=$(cat /proc/pandora/nub1/mbutton_threshold)
98 newthres=$(zenity --scale --text "Change the mousebutton sensitivity for the right nub.\nThe default value is 20.\nThe higher the value the higher you need to move the nub" --min-value=1 --max-value=40 --value=$curthres --step 1)
99 echo $newthres > /proc/pandora/nub1/mbutton_threshold
103 echo 1 > /sys/bus/i2c/drivers/vsense/3-0067/reset
105 echo 0 > /sys/bus/i2c/drivers/vsense/3-0067/reset
106 curmode=$(cat /proc/pandora/nub1/mode)
107 echo mouse > /proc/pandora/nub1/mode
108 while ! zenity --question --title="Resetted right nub" --text="The right nub has been resetted.\nPlease try to move the mouse cursor\nto test if it is working properly." --ok-label="Working properly" --cancel-label="Reset again"; do
109 echo 1 > /sys/bus/i2c/drivers/vsense/3-0067/reset
111 echo 0 > /sys/bus/i2c/drivers/vsense/3-0067/reset
113 echo $curmode > /proc/pandora/nub1/mode
120 echo mouse > /proc/pandora/nub0/mode
121 echo 150 > /proc/pandora/nub0/mouse_sensitivity
122 echo 7 > /proc/pandora/nub0/scrollx_sensitivity
123 echo 7 > /proc/pandora/nub0/scrolly_sensitivity
124 echo 20 > /proc/pandora/nub0/scroll_rate
125 echo 20 > /proc/pandora/nub0/mbutton_threshold
126 echo mbuttons > /proc/pandora/nub1/mode
127 echo 150 > /proc/pandora/nub1/mouse_sensitivity
128 echo 7 > /proc/pandora/nub1/scrollx_sensitivity
129 echo 7 > /proc/pandora/nub1/scrolly_sensitivity
130 echo 20 > /proc/pandora/nub1/scroll_rate
131 echo 20 > /proc/pandora/nub1/mbutton_threshold
132 zenity --info --title="Settings restored" --text "The default nub-settings have been restored." --timeout 6