Posts Tagged ‘wallpaper’

set the desktop wallpaper under Xfce4

March 8, 2015 1 comment

You use the Xfce4 desktop environment (e.g. with Manjaro), and you want to change the desktop wallpaper from the command line.

Get the path of the current wallpaper:

$ xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorLVDS-0/workspace0/last-image
/trash/wallpapers/hd_wallpapers_forbackground_2015.jpg  # sample output

Set the wallpaper to a new background image:

$ xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorLVDS-0/workspace0/last-image -s PATH_OF_NEW_IMAGE

Where PATH_OF_NEW_IMAGE is the absolute path of the image you want to set (to avoid problems, use absolute paths).

Xfce properties
(This paragraph is based on this post). How to list Xfce channels and their properties:

for channel in $(xfconf-query -l | grep -e '^\s'); do echo "Channel: $channel"; xfconf-query -c $channel -l; echo ''; done

This will give you a full listing of all the properties of each channel. You can query the value of a property this way:

xfconf-query -c <channel> -p <property>

Update (20150731)
I wanted to use this method on another machine of mine and it turned out that the property to be set is called differently! If I want to set the background, instead of /backdrop/screen0/monitorLVDS-0/workspace0/last-image I had to set /backdrop/screen0/monitorDVI-I-2/workspace0/last-image. Great :( So here is my updated method:

First, query all properties that end with “last-image“:

$ xfconf-query -c xfce4-desktop -l | grep "last-image$"

Sample output on my machine:


Then set the value of each of these properties to the absolute path of the background image.

Categories: manjaro Tags: , ,

my current Ubuntu wallpaper

July 11, 2014 Leave a comment


Categories: fun, ubuntu, windows Tags:

38,157 quality wallpapers

April 6, 2014 Leave a comment

Here (reddit post) you can find a torrent file that points to an 18 GB archive that contains 38,000+ quality wallpapers. The images are collected from imgur.

I downloaded it and put their imgur IDs on Gist, see here.

calling gsettings from crontab

February 6, 2014 Leave a comment

I have a script that updates my desktop wallpaper every midnight with the Bing background image (see here).

This script worked fine, but a few months ago it stopped updating my desktop. Today I had some time and tracked down the problem to the gsettings command. The script sets the background with this external command:

gsettings set org.gnome.desktop.background picture-uri file:///absolute/path/to/image.jpg

When I launched the script manually, the background was refreshed. However, when it was called from crontab, the background was not refreshed. gsettings actually set the new image, but the background was not refreshed, so I still saw the old image. Wat?

I found the solution here. As Radu Rădeanu points out, the only environment variable that is required to run the script correctly as a cron job is the DBUS_SESSION_BUS_ADDRESS, not DISPLAY or XAUTHORITY or GSETTINGS_BACKEND or something else.

Here is how to set the value of DBUS_SESSION_BUS_ADDRESS:

PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)

Now my crontab file looks like this:


0 0 * * * $HOME/bin.python/

The source of

#!/usr/bin/env bash

PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)

$DIR/ >>$HOME/bing.log.txt

Set a local file or an image by URL as your wallpaper

April 22, 2012 Leave a comment

You browse the web and you find a nice image file. “Hey, it’d look cool on my desktop!” Or, you browse your local image files: “Hey, I want to see it as my wallpaper!” How to set a background image painlessly?

With jabbapylib, of course :) Just use my new little script:

# the image is on the web:

# the image is a local file:
set_wallpaper sunshine.png

That’s all. The script is here. It relies on jabbapylib. Tested under Ubuntu Linux.

Categories: python, ubuntu Tags: ,

Set a wallpaper from command line in Gnome 3 (Unity, Gnome Shell)

April 5, 2012 Leave a comment

Under Gnome you could set the wallpaper from command line with the following commands:

gconftool-2 --type=string --set /desktop/gnome/background/picture_filename /path/to/image.jpg
gconftool-2 --type=string --set /desktop/gnome/background/picture_options stretched    # stretch the image

You try it again on a newer Ubuntu that uses Unity, and nothing happens! What’s going on?

The new way of setting a wallpaper is this:

gsettings set org.gnome.desktop.background picture-uri file:///path/to/img.jpg

Notice that you must provide a URI, hence the “file://” prefix.

The first snippet works with Gnome 2. The second one is for Gnome 3. To figure out your Gnome version, launch the command “gnome-session --version“.

Python API
I have a general-purpose Python library called “jabbapylib” (installable with pip). Setting the wallpaper is implemented here. You should use directly the module.

This tip is from here and here. Thanks.

Wallpaper Downloader and Rotator for Gnome

April 6, 2011 Leave a comment

Update (20110915): The project has changed a lot since its first release, thus the original post here got completely outdated. I rewrote this blog entry to reflect the current state of the project.


The goal of this project is twofold. First, download images from a wallpaper site. Second, rotate the downloaded images as wallpapers.

Here is the list of changes that I added to the original version:

  • New! XML support is dropped. For setting the images as wallpapers, use the script
  • New! Support for is added!
  • New! Support for is added!
  • Large images can be resized to fit your screen resolution. By default, the maximum width of images can be 1920 pixels. You can customize it in the config file. It’s recommended, this way the images will occupy much less space on your hard drive.
  • You can specify several categories and the downloader will grab images from all these sites. The same is true for rotator: you can specify several categories and it will pick a random image from the whole list. See the config file for more details.
  • The project includes an automatic wallpaper changer script called You don’t need any third-party managers anymore.
  • You can choose from several categories. You can also specify your favorite category.
  • Screen scraping is done with the BeautifulSoup library.
  • The most important change is the filtering of images that are unsuitable as wallpapers, i.e. small images, portrait images, and images with strange ratio are removed from the list.
  • Support for Flickr images (zioyero’s patch).
  • The URLs of the downloaded images are strored in an SQLite database. This way an already fetched image (either good or bad) won’t be downloaded again.

Supported wallpaper sites



First, you might want to customize some settings in the file. The most important thing is the PHOTO_DIR directory, i.e. where to store the downloaded images. Create this directory if it doesn’t exist. Then, simply launch the script:


You can also add it to your crontab:

$ crontab -e 
10 */2 * * * /absolute_path_to/

Add the second line to the end of the crontab list. Here the script is called at every two hours (at 0h10, 2h10, etc.).

For setting the images as wallpapers:

./ & 

That is, just launch it in the background. It uses the same config file as the wallpaper downloader. I put it among my startup applications, thus it starts automatically.


You can download the script from

Related posts