Friday, July 13, 2012

Generate wallpaper slideshow xml for gnome/Unity


#!/bin/bash

start='<background><starttime><year>2009</year><month>08</month><day>04</day><hour>00</hour><minute>00</minute><second>00</second></starttime>';
end='</background>';
static='<static><duration>1000.0</duration><file>%s</file></static>';
transition='<transition><duration>5.0</duration><from>%s</from><to>%s</to></transition>';

echo $start
echo
prev_file='';
ls | grep -i -e .jpg -e .png | while read line
do
   file=$PWD/$line;
   if [[ $prev_file == '' ]]
   then
      printf $static "$file";
      echo
   else
      printf $transition "$prev_file" "$file";
      echo
      printf $static "$file";
      echo
   fi
   prev_file=$file;
done
echo $end

1) In ubuntu precise the xml which provides the wallpaper slideshow is located here
/usr/share/backgrounds/contest/precise.xml

2) In order to create your own xml file you have to cd to the directory which contains the images and run this script and recirect the output to an xml file

3) After createing the xml file (eg: myshow.xml) backup the original file comes with precise and replace the newly created file to its place with the same name (precise.xml)

4) Go to system settings > appearance and select your slide show there

NOTE: make sure to keep your image filenames without spaces or use following script to replace spaces with underscores

#!/bin/bash

ls | grep '[a-zA-Z0-9]\ [a-zA-Z0-9]' | while read line
do
mv "$line" $( echo $line | sed s/' '/'_'/g )
done

1 comment:

Intel Corporation XMM7360 LTE Advanced Modem in ArchLinux

The required packages are available in ArchLinux User Repository (AUR) so it will be easier if you can use an AUR helper package like yay . ...