-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Content-ID: <alpine.LSU.2.00.0901061432420.27242@nimrodel.valinor> Hola: Resulta que hay una interfaz para darle al gnome fondos de pantalla cambiantes, y la suse trae un ejemplo en /usr/share/backgrounds/grass (rpm desktop-data-openSUSE-extra-gnome). El truco consiste en un fichero xml que define que ficheros graficos cargar y cuando: <background> <starttime> <year>2007</year> <month>09</month> <day>26</day> <hour>07</hour> <minute>00</minute> <second>00</second> </starttime> <!-- This animation will start at 7 AM. --> <!-- We start with sunrise at 7 AM. It will remain up for 1 hour. --> <static> <duration>3600.0</duration> <file>/usr/share/backgrounds/grass/1-grass-sunrise.png</file> </static> <!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, endin <transition type="overlay"> <duration>18000.0</duration> <from>/usr/share/backgrounds/grass/1-grass-sunrise.png</from> <to>/usr/share/backgrounds/grass/2-grass-day.png</to> </transition> <!-- It's 1 PM, we're showing the day image in full force now, for 2 hours ending at 3 PM <static> <duration>7200.0</duration> <file>/usr/share/backgrounds/grass/2-grass-day.png</file> </static> ... Dice qué fichero cargar a una hora determinada, que a partir de cierta hora y durante cierto tiempo hace la transición a otro, que luego cargue otro, etc. Con cuatro fotos hace una imagen de "hierba" que cambia de color según la hora del dia. Encontré esta explicación: http://danubuntu.wordpress.com/2008/07/28/cambiar-automaticamente-el-fondo-d... pero no he visto documentación sobre la interfase. Se me ocurrió usar esto para generar un fondo de pantalla cambiante con la tierra, usando xearth. Para eso hice un script que genera un xml con 48 ficheros definidos, y que también genera los 48 ficheros de La Tierra, uno para cada media hora del dia: #!/bin/bash SECUENCIA="seq 00 15 45" INTERVALO=900.0 SECUENCIA="seq 00 30 30" INTERVALO=1800.0 function generate_xml { echo "<background>" > tierra.xml echo " <starttime>" >> tierra.xml echo " <year>2009</year>" >> tierra.xml echo " <month>01</month>" >> tierra.xml echo " <day>06</day>" >> tierra.xml echo " <hour>00</hour>" >> tierra.xml echo " <minute>00</minute>" >> tierra.xml echo " <second>00</second>" >> tierra.xml echo " </starttime>" >> tierra.xml echo "" >> tierra.xml echo "<!-- Empezamos a las 00:00, cambiando cada 15 minutos -->" >> tierra.xml echo "" >> tierra.xml echo "" >> tierra.xml echo "" >> tierra.xml echo "" >> tierra.xml for X in `seq 0 1 23`; do echo "<!-- De las $X:00 a las $X:45 en 15' -->" >> tierra.xml echo "" >> tierra.xml for Y in `$SECUENCIA`; do Z=`printf "%0.2i%0.2i" $X $Y` echo "<static>" >> tierra.xml echo " <duration>$INTERVALO</duration>" >> tierra.xml echo " <file>/usr/share/backgrounds/tierra/latierra_$Z.png</file>" >> tierra.xml echo "</static>" >> tierra.xml echo "" >> tierra.xml done echo "" >> tierra.xml done echo "</background>" >> tierra.xml } function generate_png { rm /usr/share/backgrounds/tierra/latierra_*.png TODAY=`date +%Y%m%d` ZONE=`date +%z` #ZONE=`+0000` for X in `seq 0 1 23`; do for Y in `$SECUENCIA`; do # Convert local time to UTC time in the format needed by xplanet DATE=`TZ=0000 date "+%Y%m%d.%H%M00" --date="$X:$Y $ZONE"` Z=`printf "%0.2i%0.2i" $X $Y` echo $Z $DATE nice xplanet -verbosity 2 -num_times 1 -output /usr/share/backgrounds/tierra/latierra_$Z.png \ -longitude 1.0 -latitude 37.6 \ -range 100000 -radius 30 -label \ -geometry 1024x768 -date $DATE echo done done } case "$1" in xml) generate_xml ;; png) generate_png ;; *) echo "generate xml or png files" ;; esac Tiene su complicación, porque al xearth hay que darle la hora universal, mientras que el xml necesita hora local. Y no lo he conseguido, hay un error de una hora... que no voy a depurar, porque resulta que al intentarlo descubrí una cosa: que basta "tocar" el fichero xml para que se recargue él, y lo que defina. Así que el tocho de arriba queda en esto: #!/bin/bash nice xplanet -verbosity 2 -num_times 1 \ -output /usr/share/backgrounds/tierra/latierra.png \ -longitude 1.0 -latitude 37.6 \ -range 100000 -radius 30 -label \ -geometry 1024x768 touch /usr/share/backgrounds/tierra/tierra.xml Y nada más! X'-) Bueno, si, hay que poner una tarea en el cron, como por ejemplo: */20 * * * * /usr/share/backgrounds/tierra/generar > /dev/null (no hace falta que sea root, pero si que tenga permiso de escritura en el directorio de la tierra) Y poner un "tierra.xml" estático: <background> <starttime> <year>2009</year> <month>01</month> <day>06</day> <hour>00</hour> <minute>00</minute> <second>00</second> </starttime> <!-- Es una foto estatica para todo el dia; el truco es que un touch al fichero xml le hace recargar las fotos - --> <static> <duration>86400.0</duration> <file>/usr/share/backgrounds/tierra/latierra.png</file> </static> </background> Y ahora sí que está. Sólo hay que decirle a la pantalla que use como fondo "tierra.xml". Se crea un directorio /usr/share/backgrounds/tierra, con permisos de escritura al usuario que corra el cron, y listo. Contiene el script para el cron, tierra.xml, y latierra.png Customización: Para ajustar la foto a vuestro gusto, jugar con esto: nice xplanet -verbosity 2 \ -display \ -longitude 1.0 -latitude 37.6 \ -range 100000 -radius 30 -label \ -geometry 1024x768 La geometría se pone al tamaño de vuestra pantalla. El resto, al manual del xearth, tiene chorrocientas opciones. Hay ciertas opciones diferentes del cron, hacen falta. Si da problemas el cron, quitarle lo de devnull, vereis la salida del comando por correo. Si funciona se puede quitar lo de verbosity, pero no estorba (va a null). - -- Saludos Carlos E.R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkljZD8ACgkQtTMYHG2NR9Xc5wCfXaMLlDGXEn4XBY3Z1UfVW2je MnAAn38Olnia9QNdpV5fQPcVcmIkM4cG =WOOo -----END PGP SIGNATURE-----