Add a image to the list of background files in gnome

2010-03-23 188 words 1 min read

In Gnome, when you right click on the desktop background you will get a menu for ”Change Desktop backgound. The images displayed in this menu are quite a few but if you want to add your own (read: more than some 5-6 files) then it takes really some time in using the GUI to add them. And if you want to add a few 10’s of file, like say 50 then you are done.

So I wrote a simple script to add the images to the menu from command line. This was a quick script so no checks done, use at your own risk and after taking backup of related files 🙂

#Remove the last line from the file.

sed -n ’$!p’ ~/.gnome2/backgrounds.xml > /tmp/outfile
mv /tmp/outfile ~/.gnome2/backgrounds.xml

#Start adding the wallpaper
echo ”” » ~/.gnome2/backgrounds.xml
echo ”    $1” » ~/.gnome2/backgrounds.xml
echo ”    ” » ~/.gnome2/backgrounds.xml
echo ”`pwd`/$1” » ~/.gnome2/backgrounds.xml
echo ”
” » ~/.gnome2/backgrounds.xml
echo ”    zoom” » ~/.gnome2/backgrounds.xml
echo &#8221;    <shade_type>solid</shade_type>&#8221; » ~/.gnome2/backgrounds.xml
echo &#8221;    #76848F&#8221; » ~/.gnome2/backgrounds.xml
echo &#8221;    #142C3D&#8221; » ~/.gnome2/backgrounds.xml

echo &#8221;    &#8221; » ~/.gnome2/backgrounds.xml

#Add the last line again
echo &#8221;&#8221; » ~/.gnome2/backgrounds.xml


author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it