So you went to put that funny animated gif as your desktop background but only the first frame appeared, static and alone? Cheer up, we can make it move.
This is a guide to getting an animated gif centered on your desktop background. I've only tested it in gnome on Hardy Heron. It works with or without compiz. The only caveat is that if you happen to have icons on your desktop the gif may cover these up if it's big enough.
Alright let's open a terminal window and get down to business.
We're going to grab Shantz modified (i.e. fixed) version of xwinwrap.
Ok we need the source from launchpad, but first we need to install bazaar to get the code, gcc to compile it, and gifsicle to actually display the gifs:
Code:
sudo apt-get install bzr build-essential gifsicle
Now let's grab the code:
Code:
bzr branch lp:xwinwrap
Let's change into that newly created directory and compile it and then install it.
Code:
cd xwinwrap
make
sudo make install
I've created a little script to make centering a gif easy for myself so open up your favorite text editor and copy and paste the following:
Code:
#!/bin/sh
# Uses xwinwrap to display given animated .gif in the center of the screen
if [ $# -ne 1 ]; then
echo 1>&2 Usage: $0 image.gif
exit 1
fi
#get screen resolution
SCRH=`xrandr | awk '/current/ { print $8 }'`
SCRW=`xrandr | awk '/current/ { print $10 }'`
SCRW=${SCRW%\,}
#get gif resolution
IMGHW=`gifsicle --info $1 | awk '/logical/ { print $3 }'`
IMGH=${IMGHW%x*}
IMGW=${IMGHW#*x}
#calculate position
POSH=$((($SCRH/2)-($IMGH/2)))
POSW=$((($SCRW/2)-($IMGW/2)))
xwinwrap -g ${IMGHW}+${POSH}+${POSW} -ov -ni -s -nf -- gifview -w WID $1 -a
exit 0
Save this file as gifbg.sh and let's not forget to make it executable:
Now when we can make our background move:
Code:
./gifbg.sh /path/to/animated.gif
You'll probably want to start this script when you login so hit the gnome menu -> system -> preferences -> sessions hit Add and make up a name and copy the command into the appropriate box. Notes: You have to put the complete path to the script in here because gnome doesn't respect the $PATH variable. Also, for some reason the image will appear always on top when it's loaded from boot, one solution is to add a "sleep 5" on top of the script to make sure it loads after the rest of your desktop.
There you go, an animated background using a few megs of ram and an imperceptible amount of cpu time.
To stop the magic happening either Ctrl-C the command if you ran it from the terminal or hit Alt-F2 and type:
To uninstall:
Code:
sudo rm /usr/bin/xwinwrap