pandora-scripts: try to fix currentuser/home mess
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_lcdsettings.sh
index f915cc5..51f5fe7 100644 (file)
@@ -3,7 +3,9 @@
 # Video-Settings, v1.2, 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.
 
- . /usr/pandora/scripts/op_paths.sh
+. /usr/pandora/scripts/op_common.sh
+user=$(get_user)
+user_home=$(get_user_home)
 
 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
 
@@ -89,13 +91,12 @@ case $mainsel in
     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
+       sed -i "s/.*xset.*/# DISPLAY=:0 xset s off/g" $user_home/.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
+         sed -i "s/.*xset.*/DISPLAY=:0 xset s off/g" $user_home/.xinitrc
          zenity --info --title="Screen blanking" --text "The automatic screen blanking has been disabled." --timeout 6
          DISPLAY=:0 xset s off
        fi;;
@@ -110,12 +111,11 @@ case $mainsel in
       done;;
       
       "rightclickmode")
-      user=$(cat /tmp/currentuser)
       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 
-         echo 'mode = 1' > /home/$user/Applications/Settings/libgtkstylus.conf
+         echo 'mode = 1' > $user_home/Applications/Settings/libgtkstylus.conf
          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
        else
-         echo 'mode = 0' > /home/$user/Applications/Settings/libgtkstylus.conf
+         echo 'mode = 0' > $user_home/Applications/Settings/libgtkstylus.conf
          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
        fi;;