3 while mainsel=$(zenity --title="LCD-Settings" --width="300" --height="180" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "bright" "Change LCD Brightness" "gamma" "Manage LCD Gamma"); do
9 maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
10 curbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)
11 device=/sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
13 newbright=$(zenity --scale --text "set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1)
17 if [ $newbright ]; then
18 if [ $newbright -le $minbright ]; then newbright=$minbright; fi
19 if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
20 echo $newbright > $device
24 if selection=$(cat /etc/pandora/conf/gamma.conf | awk -F\; '{print $1 "\n" $2 }' | zenity --width=700 --height=400 --title="Gamma Manager" --list --column "Name" --column "Description" --text "Please select a Gamma Profile" ); then
27 gamma=$(grep "$selection" /etc/pandora/conf/gamma.conf | awk -F\; '{print $3}')
29 if [ ${gamma} = "syssyscreatenew" ]; then
30 cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma > /tmp/gamma.current
32 if zenity --question --title="Confirm new gamma setting" --text="Do you want to keep the current gamma setting or revert to the previous one?" --ok-label="Keep it" --cancel-label="Revert"; then
33 if zenity --question --title="Save as profile" --text="Do you want to save the new gamma setting as new profile?\n\nNote: You can also test it out first and save it later by restarting the Gamma Manager" --ok-label="Save it now" --cancel-label="Don't save it now"; then
34 while ! name=$(zenity --title="Save current settings" --entry --text "Please enter a Name for the new profile.") || [ "x$name" = "x" ] ; do
35 zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6
37 curr=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma)
38 desc=$(zenity --title="Save current settings" --entry --text "Please enter a description for the new profile.")
39 echo "$name;$desc;$curr" >> /etc/pandora/conf/gamma.conf
40 zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6
43 cat /tmp/gamma.current > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma
45 elif [ ${gamma} = "syssyssavecurrent" ]; then
46 curr=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma)
47 while ! name=$(zenity --title="Save current settings" --entry --text "Please enter a Name for the new profile.") || [ "x$name" = "x" ] ; do
48 zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6
50 desc=$(zenity --title="Save current settings" --entry --text "Please enter a description for the new profile.")
51 echo "$name;$desc;$curr" >> /etc/pandora/conf/gamma.conf
52 zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6
53 elif [ ${gamma} = "syssysdeleteprofile" ]; then
54 if selection2=$(cat /etc/pandora/conf/gamma.conf | grep -v syssys | awk -F\; '{print $1 "\n" $2 }' | zenity --width=700 --height=400 --title="Delete gamma profile" --list --column "Name" --column "Description" --text "Please select a Gamma Profile to Delete" ); then
55 if zenity --question --title="Confirm Profile Removal" --text="Are you REALLY sure you want to remove the profile $selection2?\n\nThere will be NO other confirmation and this can NOT be undone!" --ok-label="Yes, remove the profile!" --cancel-label="Don't remove the profile"; then
56 remove=$(grep "$selection2" /etc/pandora/conf/gamma.conf)
57 cat /etc/pandora/conf/gamma.conf | grep -v "$remove" > /tmp/gamma.conf
58 mv /tmp/gamma.conf /etc/pandora/conf/gamma.conf
59 zenity --info --title="Profile deleted" --text "The profile has been deleted." --timeout 6
61 zenity --info --title="Profile not deleted" --text "The profile has not been deleted." --timeout 6
65 echo $gamma > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma