.xinitrc: Added configuration for enabling / disabling screen blanking
[openpandora.oe.git] / recipes / pandora-system / pandora-skel / .xinitrc
index 4a8e80f..ebd0504 100644 (file)
@@ -38,22 +38,71 @@ if [ -d /etc/X11/Xsession.d ]; then
     done
 fi
 
+#Load up the proper keymap for X
+xmodmap ~/.pndXmodmap
+
+#Write the current user into /tmp/currentuser for any scripts or programs who want to make use of it
+whoami > /tmp/currentuser
+
 # HUP pndnotifyd to make sure it picks up the users home.
-kill -1 pndnotifyd 
+killall -1 pndnotifyd &
 
 # The following variable defines the session which is started if the user
 # doesn't explicitely select a session in SLiM.
 
 DEFAULT_SESSION=startxfce4
+STOP_SESSION="xfce4-session-logout --logout"
+
+# Write the default session into a temporary file.
+# This way, we can easily add new sessions in the future by just
+# setting the DEFAULT_SESSION to the executable or script.
+
+echo $DEFAULT_SESSION > /tmp/gui.load
+
+# If SLiM does pass a variable, use that. Otherwise use our DEFAULT_SESSION.
+
+SESSION=$1
+
+if [ "$SESSION" == "" ]
+
+       then
+       SESSION=$(cat /tmp/gui.load)
+fi
+
+STOP_SESSION=$(grep $SESSION /etc/pandora/conf/gui.conf | awk -F\; '{print $4}')
+echo $STOP_SESSION > /tmp/gui.stop
+chmod +x /tmp/gui.stop
+
+# Disable screen blanking if uncommented
+# DISPLAY=:0 xset s off
+
+# Starts our session and checks if a new session should be loaded
+# after the old one is quit by simply executing the command that's in /tmp/gui.load
+
+# This way, we can easily do a quick switch from any session to the next one by simply
+# echo'ing the new session executable into /tmp/gui.load and exiting.
+
+if [ -f /tmp/nocleanwarn ]; then
+    defmhz="$(cat /etc/pandora/conf/cpu.conf | grep default | awk -F\: '{print $2}')"
+      if [ $defmhz -gt 600 ]; then
+       zenity --info --title="Unclean Shutdown" --text "Warning!\n\nThe system has not been shutdown properly last time.\n\nAs you overclocked the CPU as default speed, this might be the reason for that.\nTherefore, for this session, the current CPU speed has been set to 500 MHz."
+      fi
+  rm /tmp/nocleanwarn
+ fi
+while true
+do
+       rm /tmp/gui.load
+
+       if [ "$SESSION" == "" ]
+
+       then
+               exit 0;
+       fi
 
-case $1 in
-xfce4)
-       exec startxfce4
-       ;;
-pmenu)
-       exec pmenu
-       ;;
-*)
-       exec $DEFAULT_SESSION
-       ;;
-esac
+       $SESSION
+        
+       SESSION=$(cat /tmp/gui.load)
+       STOP_SESSION=$(grep $SESSION /etc/pandora/conf/gui.conf | awk -F\; '{print $4}')
+        echo $STOP_SESSION > /tmp/gui.stop
+        chmod +x /tmp/gui.stop
+done