GNOME 3: How to Change the Wallpaper from Command-Line

Posted by Chris7mas on Dec 4, 2011 7:24 AM EDT
TuxArena; By Craciun Dan
Mail this story
Print this story

The older way of doing this, with gconftool-2 doesn’t seem to work anymore in GNOME 3, however, there is still possible to change the background image, by using the gsettings tool instead.

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:

gsettings set org.gnome.desktop.background picture-uri file:///$PATH_TO_FILE

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

gsettings set org.gnome.desktop.background picture-uri file:////home/user/image.jpg

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):

#!/bin/bash

while [[ 1 -eq 1 ]]; do for i in $(echo /usr/share/backgrounds/*.jpg); do echo $i gsettings set org.gnome.desktop.background picture-uri file:///${i} sleep 60; done done

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

Thanks for this and this.

Full Story

  Nav
» Read more about: Groups: GNOME

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.