#!/bin/sh

lxp-icewm-session

if [ -d /proc/acpi/battery/BAT0 ]; then
	cat /usr/share/lxp-icewm/preferences | sed s/TaskBarShowAPMStatus=0/TaskBarShowAPMStatus=1/g > /usr/share/lxp-icewm/preferences
else
	cat /usr/share/lxp-icewm/preferences | sed s/TaskBarShowAPMStatus=1/TaskBarShowAPMStatus=0/g > /usr/share/lxp-icewm/preferences
fi

case $LANG in
	es*)
		switch_desktop="Cambiar de escritorio"
		keyboard="Distribución del teclado"
		utilities="Utilidades"
		minino="minino_es"
	;;
	gl*)
		switch_desktop="Cambiar de escritorio"
		keyboard="Distribución do teclado"
		utilities="Utilidades"
		minino="minino_gl"
	;;
	*)	# Other
		switch_desktop="Switch desktop"
		keyboard="Keyboard layout"
		utilities="utilities"
		minino="minino_en"
	;;
esac

/usr/local/bin/rox.panelput.pl Restore
killall -9 halevt; halevt -f -u `whoami` -g plugdev & 

#----EVENTOS DE SONIDO------------#

EVENTOS_DE_SONIDO=ON
case $EVENTOS_DE_SONIDO in
	ON)
		esd &
		sleep 5; lxp-icesound --interface=ESD --sample-dir=~/.lxp-icewm/sounds &
	;;
	OFF)
		echo "Sin eventos de sonido."
		#killall esd &
		#killall lxp-icesound &
	;;
esac



#-----Establecemos el teclado predeterminado
setxkbmap `cat ~/.lxp-icewm/.defaultkeyboard`

#-----Cargamos el escritorio predeterminado
defaultdesktop=`cat ~/.lxp-icewm/.defaultdesktop`

case $defaultdesktop in
	rox)
		rox -p $minino -t minino &
	;;
	pcmanfm)
		pcmanfm&
	;;
	lxp-icewmbg)	# Sin ná
		echo "Sin ná de ná"
	;;
	icewmbg)	# Sin ná
		echo "Sin ná de ná"
	;;

esac


#----MENU PRINCIPAL---------------#
cat <<EOF > ~/.lxp-icewm/mainmenu

menuprog "$utilities" folder gmenu
prog xfe xfe xfe
separator
prog Kazehakase kazehakase-icon kazehakase
prog Firefox firefox firefox
prog AMSN amsn amsn
separator
prog Gimp gimp gimp
prog mtPaint /home/minino/.lxp-icewm/icons/mt.xpm mtpaint
prog Abiword abiword abiword
separator
#menuprog "(Gnome) Applications" folder lxp-icewm-menu-gnome2 --list /usr/share/desktop-directories
#menuprog "Programas" folder lxp-menu-generator
#menufile "Programas" folder lxp-menu
#menufile "Debian" folder programs
EOF

lxp-menu-generator >~/.lxp-icewm/lxp-menu
cat ~/.lxp-icewm/mainmenu ~/.lxp-icewm/lxp-menu >~/.lxp-icewm/menu


#-----Se ponen en marcha los botones keyboard y swithdesktop
echo "menuprogreload \"$keyboard\" keyboard 3  lxp-icewm-keyboards">~/.lxp-icewm/rightbar
echo "menuprogreload \"$switch_desktop\"  desktop  3 lxp-switch-desktop --menu">>~/.lxp-icewm/rightbar
