I got the idea from my “new” s10 because I wanted to keep the desktop clean, simple but with a touch of personality. For this reason I thought it would be cool with a stylish wallpaper and a simple picture frame on it showing a new picture chosen at random from a defined photo folder. I first thought of making a widget (or downloading one) that could add this picture frame on top of the static wallpaper, but then I thought “Why not just generate the wallpaper on login?” So that’s the project now… I spent about 10 minutes at work searching the web and here’s what I found;
First i came across a 3 line script for selecting a random picture from a specified folder and inserting it as wallpaper on the Ubuntu desktop.
Secondly I needed something to generate the wallpaper. For this purpose ImageMagick seemed like a great tool given its obvious power and console nature.
So this is what I came up with. Simple, but does the trick :)
#!/bin/bash # Script to select random image from a directory, polaroid style it and paste it on a full screen wallpaper image. # Directory Containing Pictures DIR="[your image dir]" # Command to Select a random file from directory PIC=$(ls $DIR/script_candidates/*.* | shuf -n1) # Style the selected image as a polaroid picture convert $PIC -bordercolor snow -background black +polaroid -thumbnail '300x300>' $DIR/overlay_temp.png # Append on top of a full screen wallpaper image. (the 700x300 offset just fit my needs) composite -geometry +700+200 $DIR/overlay_temp.png $DIR/wp_bg.jpg $DIR/wp_cmp.png # Command to set Background Image gconftool -t string -s /desktop/gnome/background/picture_filename $DIR/wp_cmp.png
I now have the script running upon login, and thereby have a newly generated, random wallpaper to look at every time I log in. One resulting wallpaper could (and indeed did) look like this: