#!/bin/sh

case $LANG in
	es*)
		MSG1="Detectados sus dispositivos de red"
		MSG2="Reinicie IceWM" ;;
	gl*)
		MSG1="Detectados os seus dispositivos de rede"
		MSG2="Reinicie IceWM" ;;
	*)	# Other
		MSG1="Net devices detected"
		MSG2="Restart IceWM" ;;
esac

if [ -d ~/.lxp-icewm/preferences ]; then
	NET_DEVICES=`cat /proc/net/dev | tail -n +3 | cut -f1 -d: |grep -v lo|awk '{print $1}'|tr '\012' ' ';echo`
	LINEA_BUENA=`echo NetworkStatusDevice=\"$NET_DEVICES\"`
	NUM_LINEA=`sed -n '/NetworkStatusDevice/=' ~/.lxp-icewm/preferences`
	sed -i -e $NUM_LINEA"c $LINEA_BUENA" ~/.lxp-icewm/preferences
else
	cp /usr/share/lxp-icewm/preferences ~/.lxp-icewm/preferences
	NET_DEVICES=`cat /proc/net/dev | tail -n +3 | cut -f1 -d: |grep -v lo|awk '{print $1}'|tr '\012' ' ';echo`
	LINEA_BUENA=`echo NetworkStatusDevice=\"$NET_DEVICES\"`
	NUM_LINEA=`sed -n '/NetworkStatusDevice/=' ~/.lxp-icewm/preferences`
	sed -i -e $NUM_LINEA"c $LINEA_BUENA" ~/.lxp-icewm/preferences
fi

echo $MSG1 - $NET_DEVICES - $MSG2 | aosd_cat --back-color=yellow\
	--fore-color=blue --back-opacity=135\
	--shadow-color=orange --padding=5\
	--fade-in=20 --fade-out=500\
	-u 2000 -n "arial 20" &
