pandora-scripts: Add latest GUI and Bluetooth scripts.
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_defaultgui.sh
1 #!/bin/sh
2
3 # Set the correct user for Autologin and enable / disable it.
4
5 if zenity --question --title="Autologin" --text="Do you wish to automatically login at startup?\n\nSecurity warning: This skips the password check on startup" --ok-label="Yes" --cancel-label="No"; then       
6         # echo "PREFERED_USER=$username" > /etc/default/autologin
7         sed -i "s/.*default_user.*/default_user $username/g" /etc/slim.conf
8         sed -i 's/.*auto_login.*/auto_login yes/g' /etc/slim.conf
9 else
10         if zenity --question --title="User" --text="Do you wish to have your username automatically populated in the login screen?\n\nNote: This is ideal if your the only user of the OpenPandora but wish to disable autologin and use a password." --ok-label="Yes" --cancel-label="No"; then 
11                 sed -i "s/.*default_user.*/default_user $username/g" /etc/slim.conf
12                 sed -i 's/.*auto_login.*/auto_login no/g' /etc/slim.conf
13         else
14                 sed -i "s/.*default_user.*/default_user/g" /etc/slim.conf
15                 sed -i 's/.*auto_login.*/auto_login no/g' /etc/slim.conf
16         fi
17 fi
18
19 # ----
20
21 # Select the default interface and setup SLiM to pass that as a sesion to ~./.xinitrc
22
23 while ! launcher=$(zenity --height 260 --list --title="Default User Interface" --text="Please choose your default application launcher.\n\nYou can always change this setting later." --column "return" --print-column=1 --hide-column=1 --column "Pick a launcher" "xfce" "Desktop environment (Xfce)" "mmenu" "A very basic GUI (MiniMenu)" "pmenu" "Gaming-console like launcher (PMenu)" "netbooklauncher" "Ubuntu Netbook Launcher") || [ "x$launcher" = "x" ]; do 
24         zenity --title="Error" --error --text="Please select a default launcher." --timeout 6
25 done
26
27 if [ $launcher == "xfce" ]; then 
28 #       sed -i 's/.*sessions .*/sessions xfce4,pmenu/g' /etc/slim.conf
29         sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startxfce4/g' ~/.xinitrc
30         echo Xfce selected as default interface
31 elif [ $launcher == "pmenu" ]; then
32 #       sed -i 's/.*sessions .*/sessions pmenu,xfce4/g' /etc/slim.conf
33         sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=pmenu/g' ~/.xinitrc
34         echo PMenu selected as default interface
35 elif [ $launcher == "netbooklauncher" ]; then
36         sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startnetbooklauncher/g' ~/.xinitrc
37 elif [ $launcher == "mmenu" ]; then
38         sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startmmenu/g' ~/.xinitrc
39 fi
40
41 zenity --info --title="Changed session" --text "Thankyou, the default session has been changed." --timeout 6