Animated .gif as a background Ubuntu
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:
Now let's grab the code:
Let's change into that newly created directory and compile it and then install it.
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:
Save this file as gifbg.sh and let's not forget to make it executable:
Now when we can make our background move:
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:
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
Code:
bzr branch lp:xwinwrap
Code:
cd xwinwrap make sudo make install
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
Code:
chmod +x gifbg.sh
Code:
./gifbg.sh /path/to/animated.gif
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:
Code:
killall xwinwrap
Code:
sudo rm /usr/bin/xwinwrap
Can you help me please. I followed the instructions and it said that the file loaded ,but my desktop has no changes
ReplyDeletehow can I set the gif full screen?
ReplyDeleteYou can't do that, but you should get a gif background that fit to your screen resolution. check this out hdw.eweb4.com/search/animated+gif/
Deletexwinwrap doesn't compile in Ubuntu 13.10.
ReplyDeleteIt just paints over the whole x-screen. Is there a possibility to draw it only on the background?
ReplyDeleteUsing latest arch-linux.