Wallpaper Slideshow

goose
  11 years ago
  9

It is possible, without installing any additional packages, to have a slideshow of wallpapers as your background. To do this, you should place all your desired wallpapers into a folder, and then you can run this script.

To break down the script, and explain what it does and how it works:

You can use an .xml file as a wallpaper, which will tell Mint to use a certain image for a certain amount of time, and then fade transition into a new wallpaper. Here's an exerpt of the file:

<background></background>
<starttime></starttime>
<year>2012</year>
<month>07</month>
<day>08
<hour>00</hour>
<minute>00</minute>
<second>00</second>

<static></static>
<duration>10</duration>
<file></file>
/home/goose/Pictures/wallpaper-1.jpg


<transition></transition>
<duration>2</duration>
<from></from>
/home/goose/Pictures/wallpaper-1.jpg

<to></to>
/home/goose/Pictures/wallpaper-2.jpg


<static></static>
<duration>10</duration>
<file></file>
/home/goose/Pictures/wallpaper-2.jpg


<transition></transition>
<duration>2</duration>
<from></from>
/home/goose/Pictures/wallpaper-2.jpg

<to></to>
/home/goose/Pictures/wallpaper-1.jpg


 

Now, from top to bottom, let's look at each tag, by its category.

 

<background></background> This tag opens and closes the file.

 

 

<starttime></starttime> This is the time that the first slide should have (or will) start at.
<year></year> This is the year your "Start Time" tag will use.
<month></month> This is the month your "Start Time" tag will use.
<day></day> This is the day your "Start Time" tag will use.
<hour></hour> This is the hour your "Start Time" tag will use.
<minute></minute> This is the minute your "Start Time" tag will use.
<second></second> This is the second your "Start Time" tag will use.

 

 

<static></static> This tag idenifies the wallpaper to be displayed, and how long to dispaly it for.
<duration></duration> How long the wallpaper should be dispalyed for.
<file></file> The location of the wallpaper.

 

 

<transition></transition> This will hold the details for the transition to the next wallpaper.
<duration></duration> How long the transition between wallpapers should last for.
<from></from> The wallpaper being currently dispalyed; also the wallpaper in the "Static" tag directly above.
<to></to> The next wallpaper to be displayed; also the wallpaper in the next following "Static" tag.

 

When you run the script, the following will happen:

  1. The script will ask you what directory your wallpapers are in.
  2. The script will ask how long you want to display each wallpaper for.
  3. The script will ask how long you want each transition to be.

Next, the script will write the header of the background.xml file, printing the opening <background> and <starttime> tags.</starttime></background>

After writing the header, the script will then list all the files in the directory where your wallpapers are located. It will make a note of which file starts and ends the list, and then begin a loop sequence for each file listed in the output.

For each file listed in the output, the proper <static> and <transition> tags will be added to the background.xml file, and once all files have been added, the <background> tag will be closed.</background></transition></static>

Last, the script will ask you if you want it to set your .xml file as your background file. Because of the way Mint's desktop manager is setup, it is impossible to do this through GUI, and must be done through a terminal. If you chose to not set your .XML file as your wallpaper, you can do this later with the following command:

gsettings set org.gnome.desktop.background picture-uri "file:/path/to/your/background.xml"

The easiest way to update your .xml file if you should add new wallpapers in the future, would be to simply delete your old .xml file, and re-run the script to create a new one.

Comments
goose 10 years ago

Thanks lucaswerkmeister. It never occurred to me that someone's paths or file names could have characters that would normally require escaping outside of quotations, such as spaces. I've updated the script with all the appropriate quotations necessary. If you quoted all occurrences of the ${wallpaperDir} variable, you may have unnecessarily quoted the occurrences on lines 36, 40, 41, and 42 which do not require quotes as they are already inside of quotations spanning from lines 33 to 42.


goose 11 years ago

Thanks rukh. I'm rolling dual monitors, so I need to span; however, I've added this as a prompt option. (As well as cleaned up my code a bit)


rukh 11 years ago

Thanks for this and the script, I've modified slightly for scaled background, insert after the gsettings command: gsettings set org.gnome.desktop.background picture-options 'scaled'


goose 11 years ago

Not really, oros; the only issue you would run into is if you're running more than one monitor, otherwise you can just set your wallpaper size to "scale", which would automagically scale each image to the proper size to match your screen; regarding the complex file names, the script handles all that.


oros 11 years ago

Nice, but have like 50 pics , all with complex names and different size so this would take days :p


nicamlg 11 years ago

I had already prepared my pics, but then I learned I had to write an XML in order to gtean slideshow... So I forgot about the idea until now. Thanks. :)


Ishwon 11 years ago

Nice tutorial. Thanks you.


Mintification 11 years ago

Excellent. For people looking for live wallpapers, this is a close second, and uses way less memory.


chassum 11 years ago

Well done.