From: David-John Willis Date: Tue, 16 Mar 2010 11:03:43 +0000 (+0000) Subject: pandora-scripts: Add latest GUI and Bluetooth scripts. X-Git-Tag: Release-2010-05/1~98 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=commitdiff_plain;h=59494664773963790bc0268965c5105ab4ad1e43 pandora-scripts: Add latest GUI and Bluetooth scripts. --- diff --git a/recipes/pandora-system/pandora-scripts.bb b/recipes/pandora-system/pandora-scripts.bb index 2a94b6d..cb0693b 100644 --- a/recipes/pandora-system/pandora-scripts.bb +++ b/recipes/pandora-system/pandora-scripts.bb @@ -6,7 +6,7 @@ COMPATIBLE_MACHINE = "omap3-pandora" DEPENDS = "zenity dbus" RDEPENDS = "zenity dbus" -PR = "r5" +PR = "r9" SRC_URI = " \ file://op_bright.sh \ @@ -16,7 +16,8 @@ SRC_URI = " \ file://op_wifi.sh \ file://op_wifi.desktop \ file://op_bluetooth.sh \ - file://op_bluetooth.desktop \ + file://op_bluetooth-check.desktop \ + file://op_bluetooth.desktop \ file://op_defaultgui.sh \ file://op_defaultgui.desktop \ file://op_switchgui.sh \ @@ -41,6 +42,9 @@ do_install() { install -m 0644 ${WORKDIR}/op_defaultgui.desktop ${D}${datadir}/applications/ install -m 0644 ${WORKDIR}/op_switchgui.desktop ${D}${datadir}/applications/ + install -d ${D}${sysconfdir}/xdg/autostart/ + install -m 0644 ${WORKDIR}/op_bluetooth-check.desktop ${D}${sysconfdir}/xdg/autostart/op_bluetooth-check.desktop + install -d ${D}${bindir}/ install -m 0755 ${WORKDIR}/startnetbooklauncher ${D}${bindir}/ } diff --git a/recipes/pandora-system/pandora-scripts/op_bluetooth-check.desktop b/recipes/pandora-system/pandora-scripts/op_bluetooth-check.desktop new file mode 100644 index 0000000..9ebe24c --- /dev/null +++ b/recipes/pandora-system/pandora-scripts/op_bluetooth-check.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Check Bluetooth Status +Comment=Check the status of your Bluetooth device and enable if desired. +StartupNotify=false +Exec=/usr/pandora/scripts/op_bluetooth.sh startup +Icon=bluetooth +Terminal=false +Type=Application +Categories=System; diff --git a/recipes/pandora-system/pandora-scripts/op_bluetooth.desktop b/recipes/pandora-system/pandora-scripts/op_bluetooth.desktop index e1f30f4..4009873 100644 --- a/recipes/pandora-system/pandora-scripts/op_bluetooth.desktop +++ b/recipes/pandora-system/pandora-scripts/op_bluetooth.desktop @@ -1,9 +1,9 @@ [Desktop Entry] -Name=Toggle Bluetooth +Name=Toggle Bluetooth Status Comment=Toggle the status of your Bluetooth device. StartupNotify=false Exec=/usr/pandora/scripts/op_bluetooth.sh -Icon=Terminal +Icon=bluetooth Terminal=false Type=Application Categories=System; diff --git a/recipes/pandora-system/pandora-scripts/op_bluetooth.sh b/recipes/pandora-system/pandora-scripts/op_bluetooth.sh index 506a842..b195a7d 100644 --- a/recipes/pandora-system/pandora-scripts/op_bluetooth.sh +++ b/recipes/pandora-system/pandora-scripts/op_bluetooth.sh @@ -2,23 +2,34 @@ # # Released under the GPL -SILENT=0 -while getopts s opt -do - case "$opt" in - s) SILENT=1;; - esac -done +STARTUP=0 -INTERFACE=`hciconfig | grep "^hci" | cut -d ':' -f 1` -pgrep bluetoothd -if [ $? = 1 ]; then - notify-send "Bluetooth" "The bluetooth interface is being set up..." -i /usr/share/icons/hicolor/32x32/apps/blueman.png - sudo /usr/sbin/hciconfig ${INTERFACE} down - sudo /usr/sbin/hciconfig ${INTERFACE} up pscan - sudo /usr/sbin/bluetoothd +if [ ${1} = startup ]; then + STARTUP=1 fi -if [ ${SILENT} = 0 ]; then - bluetooth-wizard +INTERFACE="`hciconfig | grep "^hci" | cut -d ':' -f 1`" + +if [ ${STARTUP} = 1 ]; then + [ -f ~/.op_btenabled ] && sudo /usr/sbin/hciconfig ${INTERFACE} up pscan && sudo /usr/sbin/bluetoothd ||echo "Bluetooth: User has not enabled Bluetooth." +else + + # Figure out if Bluetooth is running or not + + if [ "`hciconfig ${INTERFACE} | grep UP`" ] + then + notify-send -u normal "Bluetooth" "Bluetooth is being disabled..." -i /usr/share/icons/hicolor/32x32/apps/bluetooth.png + sudo /usr/sbin/hciconfig ${INTERFACE} down + rm ~/.op_btenabled + else + pgrep bluetoothd + if [ $? -ne 1 ]; then + notify-send -u normal "Bluetooth" "Bluetooth is being enabled..." -i /usr/share/icons/hicolor/32x32/apps/bluetooth.png + sudo /usr/sbin/hciconfig ${INTERFACE} down + sudo /usr/sbin/hciconfig ${INTERFACE} up pscan + sudo /usr/sbin/bluetoothd + rm ~/.op_btenabled + echo true > ~/.op_btenabled + fi + fi fi diff --git a/recipes/pandora-system/pandora-scripts/op_defaultgui.sh b/recipes/pandora-system/pandora-scripts/op_defaultgui.sh index 3e2c91f..7407acb 100644 --- a/recipes/pandora-system/pandora-scripts/op_defaultgui.sh +++ b/recipes/pandora-system/pandora-scripts/op_defaultgui.sh @@ -20,7 +20,7 @@ fi # Select the default interface and setup SLiM to pass that as a sesion to ~./.xinitrc -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 +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 zenity --title="Error" --error --text="Please select a default launcher." --timeout 6 done @@ -34,6 +34,8 @@ elif [ $launcher == "pmenu" ]; then echo PMenu selected as default interface elif [ $launcher == "netbooklauncher" ]; then sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startnetbooklauncher/g' ~/.xinitrc +elif [ $launcher == "mmenu" ]; then + sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startmmenu/g' ~/.xinitrc 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.sh b/recipes/pandora-system/pandora-scripts/op_switchgui.sh index 651c77b..051f55c 100644 --- a/recipes/pandora-system/pandora-scripts/op_switchgui.sh +++ b/recipes/pandora-system/pandora-scripts/op_switchgui.sh @@ -1,5 +1,5 @@ #!/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") +launcher=$(zenity --height 240 --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" "startmmenu" "Switch to MiniMenu" "pmenu" "Switch to PMenu" "startnetbooklauncher" "Switch to Netbook Launcher") if [ "$launcher" == "" ]; then exit 0