Ubuntu/Debian/Mint news and tutorials | Linux stuff
Quick Tip
Find Files Containing a Text Pattern
find . -iname "*.txt" -exec grep -l "hello" {} +
Quick Tip
Disable Overlay Scrollbars in GNOME
gsettings set com.canonical.desktop.interface scrollbar-mode normal
This should enable the normal scrollbars. This method works in Ubuntu 12.10 and above.
Online Readers
Advertise on TuxArena
Linux Cheat Sheet
Have a look at our Linux Cheat Sheet for quick one-liners, commands and tips.
Get UbuTricks, a graphical program which allows you to install the latest versions of several applications in Ubuntu.

The older way of doing this, with gconftool-2 doesn’t seem to work anymore in GNOME 3 – used to be something like: gconftool-2 –type string –set /desktop/gnome/background/picture_filename “/full/path/to/file.png”.

However, there is still possible to change the background image, by using the gsettings tool instead. You will need the libglib2.0-bin package, which is probably already installed on your system. To change the background, use a command like the following:

Where you replace $PATH_TO_FILE with the full path to the file, e.g.:

Here’s a small script for automatically changing the wallpaper every 60 seconds (just change the sleep 60 value to another value, in seconds). Although not very elegant, it will do the job (please suggest something better here):

This script will automatically cycle between all the .jpg wallpapers in the directory /usr/share/backgrounds/. Just replace it with another directory if needed.

Special thanks for this and this.

Share this!Share on RedditShare on StumbleUponShare on FacebookTweet about this on TwitterShare on TumblrShare on Google+
Marjeo says:

i find this script better and easy to figure out though it’s longer: start below this line —

#!/usr/bin/perl -w
use strict;
use warnings;

### Start CONFIG

my $searchPath = ‘/home/username/photos-directory/';
my $switchTime = 600; # Time is in seconds


# bgotd– background of the day
# A super simple script which randomly picks a jpg/JPG/jpeg/JPEG photo to place as your
# Gnome desktop.
# Written by Michael Moore, Nov. 2007
# This work is hereby placed in the public domain

my @photos = `find $searchPath -type f | grep [jJ][pP][eE]*[gG]`;
my $photo;

$photo = $photos[rand($#photos)];
`gsettings set org.gnome.desktop.background picture-uri “file:///$photo”`;

—end above this line —————–modify the “my$searchPath” then make it executable—————–

Craciun Dan says:

That’s nice, I’ll give it a try the next time I’ll boot into GNOME.

Daria says:

why not a cronjob?

Jabba Laci says:

Type “crontab -e”, then add the following line:

* * * * * /path/to/this/script.py

Save and exit; it’ll install this new cronjob. Then your script will be called once in every minute.

cousteau says:

Damn, now my script won’t work in both gnome2 and gnome3 with the same command.

By the way,
for i in $(echo /usr/share/backgrounds/*.jpg)
instead of just
for i in /usr/share/backgrounds/*.jpg
is not only longer and pointless but also problematic if a background has spaces in its name.

(Also, there are so many – instead of – – here…)

Leave a Comment