2 # Released under the GPL
3 # Video-Settings, v1.2, written by Michael Mrozek aka EvilDragon 2010. Brightness-Settings-Part written by vimacs.
4 # This scripts allows you to create, load and save Gamma-Settings and to change the LCD Brightness.
6 . /usr/pandora/scripts/op_common.sh
8 user_home=$(get_user_home)
10 while mainsel=$(zenity --title="Video Settings" --width="300" --height="370" --list --column "id" --column "Please select" --hide-column=1 --text="Welcome to the Video Settings-Dialogue.\n\nWhat do you want to do?\n" "bright" "Change LCD Brightness" "gammasimple" "Manage Gamma (simple)" "gamma" "Manage Gamma (Advanced)" "filter" "Select current video filter" "filterdef" "Select default video filter" "sblank" "Enable/disable screen blanking" "rightclickmode" "Select Right-Click-Mode for touchscreen" "tvout" "Enable/disable TV Out on Startup" --ok-label="Change Setting" --cancel-label="Exit"); do
16 maxbright=$(cat $SYSFS_BACKLIGHT/max_brightness)
17 curbright=$(cat $SYSFS_BACKLIGHT/brightness)
19 newbright=$(zenity --scale --text "Set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1)
23 if [ $newbright ]; then
24 if [ $newbright -le $minbright ]; then newbright=$minbright; fi
25 if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
26 echo $newbright > $SYSFS_BACKLIGHT_BRIGHTNESS
30 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
33 gamma=$(grep "$selection" /etc/pandora/conf/gamma.conf | awk -F\; '{print $3}')
35 if [ "${gamma}" = "syssyscreatenew" ]; then
36 cat $SYSFS_GAMMA > /tmp/gamma.current
38 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
39 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
40 while ! name=$(zenity --title="Save current settings" --entry --text "Please enter a Name for the new profile.") || [ "x$name" = "x" ] ; do
41 zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6
43 curr=$(cat $SYSFS_GAMMA)
44 desc=$(zenity --title="Save current settings" --entry --text "Please enter a description for the new profile.")
45 echo "$name;$desc;$curr" >> /etc/pandora/conf/gamma.conf
46 zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6
49 cat /tmp/gamma.current > $SYSFS_GAMMA
51 elif [ "${gamma}" = "syssyssavecurrent" ]; then
52 curr=$(cat $SYSFS_GAMMA)
53 while ! name=$(zenity --title="Save current settings" --entry --text "Please enter a Name for the new profile.") || [ "x$name" = "x" ] ; do
54 zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6
56 desc=$(zenity --title="Save current settings" --entry --text "Please enter a description for the new profile.")
57 echo "$name;$desc;$curr" >> /etc/pandora/conf/gamma.conf
58 zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6
59 elif [ ${gamma} = "syssysdeleteprofile" ]; then
60 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
61 if [ "${selection2}" = "Default Gamma" ]; then
62 zenity --title="Error" --error --text="You cannot delete the default Gamma settings" --timeout 6
64 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
65 remove=$(grep "$selection2" /etc/pandora/conf/gamma.conf)
66 cat /etc/pandora/conf/gamma.conf | grep -v "$remove" > /tmp/gamma.conf
67 mv /tmp/gamma.conf /etc/pandora/conf/gamma.conf
68 zenity --info --title="Profile deleted" --text "The profile has been deleted." --timeout 6
70 zenity --info --title="Profile not deleted" --text "The profile has not been deleted." --timeout 6
75 echo $gamma > $SYSFS_GAMMA
80 if selection=$(head -1 /etc/pandora/conf/dss_fir/* | sed 's:==> ::' | sed 's: <==::' | sed '/^$/d' | zenity --width=700 --height=200 --title="Videofilter" --hide-column=1 --list --column "filter" --column "Videofilter" --text "Please select a videofilter" ); then
81 videofilter=$(basename $selection)
82 sudo /usr/pandora/scripts/op_videofir.sh $videofilter
83 zenity --info --title="Videofilter applied" --text "The videofilter has been applied." --timeout 6
87 if selection=$(head -1 /etc/pandora/conf/dss_fir/* | sed 's:==> ::' | sed 's: <==::' | sed '/^$/d' | zenity --width=700 --height=200 --title="Videofilter" --hide-column=1 --list --column "filter" --column "Videofilter" --text "Please select a videofilter which will automatically be set on startup" ); then
88 videofilter=$(basename $selection)
89 echo $videofilter > /etc/pandora/conf/filter.state
90 zenity --info --title="Default Videofilter set" --text "The default video filter has been set." --timeout 6
94 if zenity --question --title="Screen blanking" --text="Do you want to enable or disable the automatic screen blanking?" --ok-label="Enable it" --cancel-label="Disable it"; then
95 sed -i "s/.*xset.*/# DISPLAY=:0 xset s off/g" $user_home/.xinitrc
96 zenity --info --title="Screen blanking" --text "The automatic screen blanking has been enabled." --timeout 6
99 sed -i "s/.*xset.*/DISPLAY=:0 xset s off/g" $user_home/.xinitrc
100 zenity --info --title="Screen blanking" --text "The automatic screen blanking has been disabled." --timeout 6
101 DISPLAY=:0 xset s off
105 dsscurr=$(cat /etc/pandora/conf/dssgamma.state)
106 while dssgamma=$(zenity --scale --text "Set Quick Gamma (Standard: 100)\n\nPress Ok to apply and Cancel to go back to the main menu." --min-value=0 --max-value=200 --value=$dsscurr --step 1); do
107 dssgamma2=$(echo "scale=2;$dssgamma / 100" | bc)
109 echo $dsscurr > /etc/pandora/conf/dssgamma.state
110 sudo /usr/pandora/scripts/op_gamma.sh $dssgamma2
114 if zenity --question --title="Right-Click Mode" --text="Choose how you would like to do a right-click with the touchscreen: You can either use the click-and-hold-method to right click or to use ALT as modifier key." --ok-label="ALT as modifier" --cancel-label="Click-and-Hold"; then
115 echo 'mode = 1' > $user_home/Applications/Settings/libgtkstylus.conf
116 zenity --info --title="Right-Click" --text "To do a right-click with the stylus, press and hold the ALT button while clicking.\n\nYou need to restart X to enable this." --timeout 6
118 echo 'mode = 0' > $user_home/Applications/Settings/libgtkstylus.conf
119 zenity --info --title="Right-Click" --text "To do a right-click with the stylus, press and hold the stylus on the screen.\n\nYou need to restart X to enable this." --timeout 6
123 if zenity --question --title="TV Out on startup" --text="Do you want to enable the TV Output on startup?" --ok-label="Enable TV Out" --cancel-label="Disable TV Out"; then
124 touch /etc/pandora/conf/tvout.state
125 zenity --info --title="TV Out" --text "TV Out will be switched on with the last saved settings on bootup." --timeout 6
127 if [ -f /etc/pandora/conf/tvout.state ]; then
128 rm /etc/pandora/conf/tvout.state
130 zenity --info --title="TV Out" --text "TV Out will not be switched on on bootup." --timeout 6