[Linux-Biella] Pacchetto di sfondi personalizzato.

Daniele Segato daniele.bilug a gmail.com
Lun 3 Ott 2011 10:28:49 CEST


On Thu, 2011-09-29 at 11:50 +0000, igoralba74 a gmail.com wrote:
> Inanzi tutto, buongiorno a tutti.
> 
> Ho notato che nelle immagini predefinite di ubuntu per uso sfondo desktop, esiste anche un  pacchetto di diverse immagini che ha rotazione ha tempo non proprio definito cambia. 
> 
> Mi chiedevo se qualcuno sapesse.
> 
> Se volessi creare un pacchetto di 10 immagini personalizzate che ogni 10 minuti ruotano da sfondo scrivania, come potrei fare?
> 
> Grazie in anticipo per la collaborazione.

non esiste documentazione se non guardare com'è fatto il file cosmos...

io ho uno screenshot che cambia molto lentamente tonalità

questo è lo script che ho usato per generare il file .xml che descrive
le transizioni...

a te possono servire le funzioni starttime, static e transition


sostanzialmente metti tutte le immagini in una directory

quindi crea uno script a partire dal mio in cui, sotto alle funzioni,
scrivi:


echo '<background>' > "${xml}";

starttime >> "${xml}";

static 3600 <nome_immagine>
transition 30 <prev_file> <next_file>

# altre immagini statiche e transizioni...

echo '</background>' >> "${xml}";


poi esegui il file .sh che ti crea l'xml, vai nella scelta background e
scegli il file .xml

ci sono anche programmi per farlo a manina....

questo è lo script che ho fatto per il mio desktop


#!/bin/bash
#Daniele Segato Animation generator
#This script generates an XML file for Animate the wallpaer for
DebianSqeezeHueRotation
#This script is released under the GPLv3 license

# I created the images with this script (use image magick)
function image_preparation() {
	# see http://www.imagemagick.org/Usage/color_mods/#modulate
	for hue in `seq 0 5 199`; do
		echo -n "converting to hue ${hue}...";
		convert original.png -modulate 100,100,${hue} "hue_${hue}.png";
		if [[ $? -eq 0 ]] ; then
			echo 'done';
		else
			echo 'FAIL';
		fi;
	done
}

xml='Debian-Sqeeze-Hue-Rotation.xml'
dir=`pwd`

BASE_FILE_NAME='hue_';
FILE_EXTENSION='.png';

HUE_START=0;
HUE_STEP=5;
HUE_END=199;

# I made the whole transition to loop every 20 minutes (aka 1200
seconds)
# since my steps is 5 and there are 200 hue level: 200/5 = 40 images
# I want to equally distribute in 600 seconds so every transition should
last 1200/200=6 seconds
# but since steps are really near to each other I prefer to leave 5
seconds static and 1 second for transitions

# changes to make the transition faster

# seconds
STATIC_DURATION='5.0'
TRANSITION_DURATION='1.0'

function starttime() {
	echo '
	<starttime>
		<year>2010</year>
		<month>01</month>
		<day>01</day>
		<hour>00</hour>
		<minute>00</minute>
		<second>00</second>
	</starttime>
';
}

function static() {
	duration="$1";
	file="$2";

	if [[ $duration = '0.0' ]] ; then
		return;
	fi

	echo "
	<static>
		<duration>${duration}</duration>
		<file>${file}</file>
	</static>";
}

function transition() {
	duration="$1";
	file_from="$2";
	file_to="$3";
	transition_type='"overlay"';

	if [[ $duration = '0.0' ]] ; then
		return;
	fi

	echo "
	<transition type=${transition_type}>
		<duration>${duration}</duration>
		<from>${file_from}</from>
		<to>${file_to}</to>
	</transition>";
}

#### the following part can be adapted ####

echo '<background>' > "${xml}";

starttime >> "${xml}";

# the last one
firstFile="${dir}/${BASE_FILE_NAME}${HUE_START}${FILE_EXTENSION}";
prevFile="${firstFile}";
HUE_SECOND=`seq ${HUE_START} ${HUE_STEP} ${HUE_END} | head -2 | tail -1`

for hue in `seq ${HUE_SECOND} ${HUE_STEP} ${HUE_END}`; do
	currFile="${dir}/${BASE_FILE_NAME}${hue}${FILE_EXTENSION}";
	echo "prev: $prevFile --> curr: $currFile";

	static ${STATIC_DURATION} "${prevFile}" >> "${xml}";
	transition ${TRANSITION_DURATION} "${prevFile}" "${currFile}" >>
"${xml}";

	prevFile="${currFile}";
done

# last transition (back to start)
echo "prev: $prevFile --> curr: $firstFile";
static ${STATIC_DURATION} "${prevFile}" >> "${xml}";
transition ${TRANSITION_DURATION} "${prevFile}" "${firstFile}" >>
"${xml}";

echo '</background>' >> "${xml}";

echo "XML background file generated: $dir/$xml"




Maggiori informazioni sulla lista Linux