#!/bin/bash
+# Released under the GPL
+# LCD-Settings, v1.0, written by Michael Mrozek aka EvilDragon 2010. Brightness-Settings-Part written by vimacs.
+# This scripts allows you to create, load and save Gamma-Settings and to change the LCD Brightness.
-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
+while mainsel=$(zenity --title="LCD-Settings" --width="300" --height="280" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "bright" "Change LCD Brightness" "gamma" "Manage LCD Gamma" "filter" "Select current video filter" "filterdef" "Select default video filter" "sblank" "Enable/disable screen blanking" ); do
case $mainsel in
curbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)
device=/sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
if [ ! $1 ]; then
- newbright=$(zenity --scale --text "set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1)
+ newbright=$(zenity --scale --text "Set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1)
else
newbright=$1
fi
gamma=$(grep "$selection" /etc/pandora/conf/gamma.conf | awk -F\; '{print $3}')
- if [ ${gamma} = "syssyscreatenew" ]; then
+ if [ "${gamma}" = "syssyscreatenew" ]; then
cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma > /tmp/gamma.current
op_gammatool
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
else
cat /tmp/gamma.current > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma
fi
- elif [ ${gamma} = "syssyssavecurrent" ]; then
+ elif [ "${gamma}" = "syssyssavecurrent" ]; then
curr=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma)
while ! name=$(zenity --title="Save current settings" --entry --text "Please enter a Name for the new profile.") || [ "x$name" = "x" ] ; do
zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6
zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6
elif [ ${gamma} = "syssysdeleteprofile" ]; then
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
- 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
+ if [ "${selection2}" = "Default Gamma" ]; then
+ zenity --title="Error" --error --text="You cannot delete the default Gamma settings" --timeout 6
+ else
+ 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
remove=$(grep "$selection2" /etc/pandora/conf/gamma.conf)
cat /etc/pandora/conf/gamma.conf | grep -v "$remove" > /tmp/gamma.conf
mv /tmp/gamma.conf /etc/pandora/conf/gamma.conf
zenity --info --title="Profile deleted" --text "The profile has been deleted." --timeout 6
- else
+ else
zenity --info --title="Profile not deleted" --text "The profile has not been deleted." --timeout 6
- fi
+ fi
fi
+ fi
else
echo $gamma > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma
fi
fi;;
+
+ "filter")
+ 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
+ videofilter=$(basename $selection)
+ sudo /usr/pandora/scripts/op_videofir.sh $videofilter
+ zenity --info --title="Videofilter applied" --text "The videofilter has been applied." --timeout 6
+ fi;;
+
+ "filterdef")
+ 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
+ videofilter=$(basename $selection)
+ echo $videofilter > /etc/pandora/conf/filter.state
+ zenity --info --title="Default Videofilter set" --text "The default video filter has been set." --timeout 6
+ fi;;
+
+ "sblank")
+ user=$(cat /tmp/currentuser)
+ 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
+ sed -i "s/.*xset.*/# DISPLAY=:0 xset s off/g" /home/${user}/.xinitrc
+ zenity --info --title="Screen blanking" --text "The automatic screen blanking has been enabled." --timeout 6
+ DISPLAY=:0 xset s on
+ else
+ sed -i "s/.*xset.*/DISPLAY=:0 xset s off/g" /home/${user}/.xinitrc
+ zenity --info --title="Screen blanking" --text "The automatic screen blanking has been disabled." --timeout 6
+ DISPLAY=:0 xset s off
+ fi;;
esac
-done
\ No newline at end of file
+done
+
+
+DISPLAY=:0 xset s off