pandora-scripts: Add latest scripts to set and switch the default GUI.
authorDavid-John Willis <John.Willis@Distant-earth.com>
Tue, 2 Mar 2010 16:04:41 +0000 (16:04 +0000)
committerDavid-John Willis <John.Willis@Distant-earth.com>
Tue, 2 Mar 2010 16:04:41 +0000 (16:04 +0000)
recipes/pandora-system/pandora-scripts.bb
recipes/pandora-system/pandora-scripts/op_defaultgui.desktop
recipes/pandora-system/pandora-scripts/op_defaultgui.sh
recipes/pandora-system/pandora-scripts/op_switchgui.desktop [new file with mode: 0644]
recipes/pandora-system/pandora-scripts/op_switchgui.sh [new file with mode: 0644]
recipes/pandora-system/pandora-scripts/startnetbooklauncher [new file with mode: 0644]

index 7d22bbd..2a94b6d 100644 (file)
@@ -6,7 +6,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 DEPENDS = "zenity dbus"
 RDEPENDS = "zenity dbus"
 
-PR = "r4"
+PR = "r5"
 
 SRC_URI = " \
           file://op_bright.sh \
@@ -19,6 +19,9 @@ SRC_URI = " \
           file://op_bluetooth.desktop \
           file://op_defaultgui.sh \
           file://op_defaultgui.desktop \
+          file://op_switchgui.sh \
+          file://op_switchgui.desktop \
+          file://startnetbooklauncher \
 "
 
 do_install() {
@@ -26,12 +29,20 @@ do_install() {
           install -m 0755 ${WORKDIR}/op_bright.sh ${D}${prefix}/pandora/scripts/
           install -m 0755 ${WORKDIR}/op_cpuspeed.sh ${D}${prefix}/pandora/scripts/
           install -m 0755 ${WORKDIR}/op_wifi.sh ${D}${prefix}/pandora/scripts/
-          install -m 0755 ${WORKDIR}/op_bluetooth.sh ${D}${prefix}/pandora/scripts/          
+          install -m 0755 ${WORKDIR}/op_bluetooth.sh ${D}${prefix}/pandora/scripts/
+          install -m 0755 ${WORKDIR}/op_defaultgui.sh ${D}${prefix}/pandora/scripts/
+          install -m 0755 ${WORKDIR}/op_switchgui.sh ${D}${prefix}/pandora/scripts/
+          
           install -d ${D}${datadir}/applications/
           install -m 0644 ${WORKDIR}/op_bright.desktop ${D}${datadir}/applications/
           install -m 0644 ${WORKDIR}/op_cpuspeed.desktop ${D}${datadir}/applications/
           install -m 0644 ${WORKDIR}/op_wifi.desktop ${D}${datadir}/applications/
           install -m 0644 ${WORKDIR}/op_bluetooth.desktop ${D}${datadir}/applications/
+          install -m 0644 ${WORKDIR}/op_defaultgui.desktop ${D}${datadir}/applications/
+          install -m 0644 ${WORKDIR}/op_switchgui.desktop ${D}${datadir}/applications/          
+
+          install -d ${D}${bindir}/
+          install -m 0755 ${WORKDIR}/startnetbooklauncher ${D}${bindir}/
 }
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
index 96141a4..249bbf2 100644 (file)
@@ -1,8 +1,8 @@
 [Desktop Entry]
-Name=Select Default GUI
-Comment=Change the default OpenPandora GUI
+Name=Select the default GUI
+Comment=Change the default OpenPandora GUI.
 StartupNotify=false
-Exec=gksudo /usr/pandora/scripts/op_defaultgui.sh
+Exec=/usr/pandora/scripts/op_defaultgui.sh
 Icon=Terminal
 Terminal=false
 Type=Application
index 5243b50..3e2c91f 100644 (file)
@@ -1,8 +1,26 @@
 #!/bin/sh
 
-# Select the default interface.
+# Set the correct user for Autologin and enable / disable it.
+
+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              
+       # echo "PREFERED_USER=$username" > /etc/default/autologin
+       sed -i "s/.*default_user.*/default_user $username/g" /etc/slim.conf
+       sed -i 's/.*auto_login.*/auto_login yes/g' /etc/slim.conf
+else
+       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 
+               sed -i "s/.*default_user.*/default_user $username/g" /etc/slim.conf
+               sed -i 's/.*auto_login.*/auto_login no/g' /etc/slim.conf
+       else
+               sed -i "s/.*default_user.*/default_user/g" /etc/slim.conf
+               sed -i 's/.*auto_login.*/auto_login no/g' /etc/slim.conf
+       fi
+fi
+
+# ----
+
+# Select the default interface and setup SLiM to pass that as a sesion to ~./.xinitrc
 
-while ! launcher=$(zenity --list --title="Default User Interface" --text="Please choose your default application launcher." --column "return" --print-column=1 --hide-column=1 --column "Pick a launcher" "xfce" "Desktop environment (Xfce)" "pmenu" "Gaming-console like launcher (PMenu)") || [ "x$launcher" = "x" ]; do 
+while ! launcher=$(zenity --height 250 --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)" "pmenu" "Gaming-console like launcher (PMenu)" "netbooklauncher" "Ubuntu Netbook Launcher") || [ "x$launcher" = "x" ]; do 
        zenity --title="Error" --error --text="Please select a default launcher." --timeout 6
 done
 
@@ -10,20 +28,12 @@ if [ $launcher == "xfce" ]; then
 #      sed -i 's/.*sessions .*/sessions xfce4,pmenu/g' /etc/slim.conf
        sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startxfce4/g' ~/.xinitrc
        echo Xfce selected as default interface
-else
+elif [ $launcher == "pmenu" ]; then
 #      sed -i 's/.*sessions .*/sessions pmenu,xfce4/g' /etc/slim.conf
        sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=pmenu/g' ~/.xinitrc
        echo PMenu selected as default interface
+elif [ $launcher == "netbooklauncher" ]; then
+       sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startnetbooklauncher/g' ~/.xinitrc
 fi
 
-# Set the correct user for Autologin and enable / disable it.
-
-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              
-       # echo "PREFERED_USER=$username" > /etc/default/autologin
-       sudo sed -i 's/.*auto_login.*/auto_login yes/g' /etc/slim.conf
-else
-       sudo sed -i 's/.*auto_login.*/auto_login no/g' /etc/slim.conf
-       fi
-fi
-
-# ----
+zenity --info --title="Changed session" --text "Thankyou, the default session has been changed." --timeout 6
diff --git a/recipes/pandora-system/pandora-scripts/op_switchgui.desktop b/recipes/pandora-system/pandora-scripts/op_switchgui.desktop
new file mode 100644 (file)
index 0000000..263ecb1
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Switch GUI
+Comment=Switch to a different GUI.
+StartupNotify=false
+Exec=/usr/pandora/scripts/op_switchgui.sh
+Icon=Terminal
+Terminal=false
+Type=Application
+Categories=System;
diff --git a/recipes/pandora-system/pandora-scripts/op_switchgui.sh b/recipes/pandora-system/pandora-scripts/op_switchgui.sh
new file mode 100644 (file)
index 0000000..651c77b
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+launcher=$(zenity --height 220 --list --title="Switch to a different GUI" --text="Please select the GUI you want to switch to.\nNote: All running applications will be terminated!" --column "return" --print-column=1 --hide-column=1 --column "Pick a launcher" "startxfce4" "Switch to Xfce" "pmenu" "Switch to PMenu" "startnetbooklauncher" "Switch to Netbook Launcher")
+
+if [ "$launcher" == "" ]; then 
+    exit 0
+else
+    echo "$launcher" > /tmp/gui.load
+    if [ "$(pidof xfce4-session)" ] 
+      then
+       xfce4-session-logout --logout
+      else
+       killall netbook-launcher-efl
+     fi
+fi
diff --git a/recipes/pandora-system/pandora-scripts/startnetbooklauncher b/recipes/pandora-system/pandora-scripts/startnetbooklauncher
new file mode 100644 (file)
index 0000000..d606ffd
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+xfwm4&
+netbook-launcher-efl
\ No newline at end of file