I have just installed Mate DE on Ubuntu 16.10. I want to change my desktop background automatically after each login. On LXDE this was done easily with immediate effect (sleep just for autoload after desktop is loaded) with the next command:

bash -c 'sleep 5; pcmanfm -w "$(find ~/Pictures/Wallpapers -type f | shuf -n1)"'

This is, of course, not working on Mate. I get this error:

Desktop manager is not active.

The only solutions I get for Mate involve mateconftool-2, which I do not have installed and it looks like it is deprecated. It should be replaced by something else, probably gconftool-2 or gsettings.

Just replacing the following mateconftool-2 command by gconftool-2 (this is from a few forums' posts I've read) does nothing:

mateconftool-2 -t string -s /desktop/mate/background/picture_filename $(find ~/Pictures/Wallpapers -type f | shuf -n1)

The gsettings command is accepted, but doesn't change the actual picture:

gsettings set org.gnome.desktop.background picture-uri "file://$(find ~/Pictures/Wallpapers -type f | shuf -n1)"

Although I can see it has changed the value:

myusername@mypcname:~$ gsettings get org.gnome.desktop.background picture-uri 'file:///home/myusername/Pictures/Wallpapers/Horex-VR6-Cafe-Racer-33-LTD-2014-1920x1080-001.jpg'

How do I get it working?

2 Answers 2


You can use the dconf tool for this.

For example:

dconf write /org/mate/desktop/background/picture-filename "'PATH-TO-JPEG'"

Note the quoting for the image filename/path. dconf expects a string so needs the single quotes, and your shell will need the double quotes to keep the single quotes.

  • works fine. please note the quoting in PATH-TO-JPEG: you need single-quotes (dconf syntax, I suppose) enclosed in double quotes (for bash). Oct 1, 2018 at 11:49
  • This other question's answer seems to indicate that while indeed dconf will work, gsettings is a preferred front-end to dconf: askubuntu.com/a/249924/234023
    – Justin
    Mar 11, 2020 at 20:19

You can do something like that


# images directory

# Create image list from directory

# Compute the number of images

# Random select
selection=$((${RANDOM} % ${nbre}))

# Image loading
gsettings set org.mate.background picture-filename ${liste[${selection}]}
  • Excellent! Thanks, this worked, both the Mate location and object in there were wrong for me before. This works now: gsettings set org.mate.background picture-filename "$(find ~/Pictures/Wallpapers -type f | shuf -n1)"
    – uldics
    Nov 4, 2019 at 19:55
  • Hmm, on Ubuntu 19.10 this actually only works when put in a terminal, but not from Mate autostart or from Mate panel Custom Application Launcher - it just changes to blue background, as if file not found. Any suggestions? Do I have a problem with those weird parentheses, or some environment variable must be set?
    – uldics
    Nov 16, 2019 at 18:38
  • For the record, for gsettings to work, we need DBUS_SESSION_BUS_ADDRESS, so this command has to be run before gsettings: export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep mate-session)/environ|cut -d= -f2- | tr -d '\0')
    – uldics
    Mar 21, 2020 at 12:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .