1 # This script sets up a few XDG vairables for the OpenPandora (to find the Xfce defaults etc.)
2 # and then launches the chosen user session (mainly Xfce or PMenu)
4 # The makes sure that /etc/xdg/op is added to the vairables to get the defaults for the OP.
5 if test "x$XDG_CONFIG_DIRS" = "x"
7 XDG_CONFIG_DIRS="/etc/xdg/op:/etc/xdg"
9 XDG_CONFIG_DIRS="/etc/xdg/op:$XDG_CONFIG_DIRS:/etc/xdg"
11 export XDG_CONFIG_DIRS
13 if test "x$XDG_DATA_DIRS" = "x"
15 XDG_DATA_DIRS="/usr/local/share:/usr/share:@_datadir_@"
16 XDG_DATA_DIRS="/etc/xdg/op:/usr/local/share:/usr/share:@_datadir_@"
18 XDG_DATA_DIRS="$XDG_DATA_DIRS:@_datadir_@"
19 XDG_DATA_DIRS="/etc/xdg/op:$XDG_DATA_DIRS:@_datadir_@"
23 # Use FreeDesktop XDG dir vars to put user data in non hidden dirs to make
24 # maintaince easier for users.
25 # These really should be set somewhere better but for now this will work.
26 export XDG_DATA_HOME=$HOME/Applications/Data
27 export XDG_CONFIG_HOME=$HOME/Applications/Settings
28 export XDG_CACHE_HOME=$HOME/Applications/Cache
30 #HACK: Run Xsession.d from here :-o
31 #Wrong, wrong, wrong but it works and sorting out OE's X server chain is not going to happen right now.
33 if [ -d /etc/X11/Xsession.d ]; then
34 for i in `ls /etc/X11/Xsession.d/` ; do
35 if [ -r "/etc/X11/Xsession.d/$i" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
36 . "/etc/X11/Xsession.d/$i"
41 #Load up the proper keymap for X
44 #Write the current user into /tmp/currentuser for any scripts or programs who want to make use of it
45 whoami > /tmp/currentuser
46 id -u > /tmp/currentuid
48 # HUP pndnotifyd to make sure it picks up the users home.
49 killall -1 pndnotifyd &
51 # The following variable defines the session which is started if the user
52 # doesn't explicitely select a session in SLiM.
54 DEFAULT_SESSION=startxfce4
55 STOP_SESSION="xfce4-session-logout --logout"
57 # Write the default session into a temporary file.
58 # This way, we can easily add new sessions in the future by just
59 # setting the DEFAULT_SESSION to the executable or script.
61 echo $DEFAULT_SESSION > /tmp/gui.load
63 # If SLiM does pass a variable, use that. Otherwise use our DEFAULT_SESSION.
67 if [ "$SESSION" == "" ]
70 SESSION=$(cat /tmp/gui.load)
73 STOP_SESSION=$(grep $SESSION /etc/pandora/conf/gui.conf | awk -F\; '{print $4}')
74 echo $STOP_SESSION > /tmp/gui.stop
75 chmod +x /tmp/gui.stop
77 # Disable screen blanking if uncommented
78 # DISPLAY=:0 xset s off
80 # Starts our session and checks if a new session should be loaded
81 # after the old one is quit by simply executing the command that's in /tmp/gui.load
83 # This way, we can easily do a quick switch from any session to the next one by simply
84 # echo'ing the new session executable into /tmp/gui.load and exiting.
86 if [ -f /tmp/nocleanwarn ]; then
87 defmhz="$(cat /etc/pandora/conf/cpu.conf | grep default | awk -F\: '{print $2}')"
88 if [ $defmhz -gt 600 ]; then
89 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."
97 if [ "$SESSION" == "" ]
105 SESSION=$(cat /tmp/gui.load)
106 STOP_SESSION=$(grep $SESSION /etc/pandora/conf/gui.conf | awk -F\; '{print $4}')
107 echo $STOP_SESSION > /tmp/gui.stop
108 chmod +x /tmp/gui.stop