op_switchgui.sh: Exits the script when no selection was made (instead of dropping...
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_switchgui.sh
old mode 100644 (file)
new mode 100755 (executable)
index 651c77b..d342a06
@@ -1,14 +1,24 @@
-#!/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")
+#!/bin/bash
 
-if [ "$launcher" == "" ]; then 
+selection=$(cat /etc/pandora/conf/gui.conf | grep -v NOSWITCH | awk -F\; '{print $1 "\n" $2 }' | zenity --width=500 --height=300 --title="Switch to a different GUI" --list --column "name" --column "description" --text "Select a GUI you want to switch to" )
+echo $selection
+
+if [ $selection ]; then
+
+  gui=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $3}')
+  stopnew=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $4}')
+
+  echo $gui
+
+  if [ $gui ]; then 
+    echo "$gui" > /tmp/gui.load
+    echo "$stopnew" > /tmp/gui.stopnew
+    echo $selection will be started
+    /tmp/gui.stop
+  else
     exit 0
+  fi
 else
-    echo "$launcher" > /tmp/gui.load
-    if [ "$(pidof xfce4-session)" ] 
-      then
-       xfce4-session-logout --logout
-      else
-       killall netbook-launcher-efl
-     fi
+  echo "Nothing selected."
+  exit 0
 fi