I wrote a little python script, that downloads a random astronomy picture of the day and then sets it as the desktop wallpaper.

When i was on Ubuntu 13.10 with gnome installed this script used to work fine, and i had it change my background via cronjob every few hours and it worked well.

However, now I have installed Ubuntu Gnome 13.10 and it behaves very strangely. The download works well, every time I run the script a new picture is being downloaded. However it only changes the wallpaper on the first time after a fresh start/ fresh log in. Starting with the second execution there's an ''animation'' on the desktop (turning blueish) but the wallpaper stays the same even though there's a different picture saved in my wallpaper directory. When i log out and back in again, the new picture appears as the wallpaper.

Does anyone know what may cause it? I've found this and implemented it, but it changed nothing. Also I think it is not related to crontab, because it also fails by manual execution.

The command used to set the wallpaper is the following

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

EDIT: The command above is the only relevant part, since executing it directly via terminal produces the same behavior.

  • can you provide whole script? or atleast the essential parts? – Registered User Feb 9 '14 at 10:55
  • Thanks for your comment, please see my edit. Sorry that I have not made this clear enough. – stebu92 Feb 9 '14 at 11:00
  • have you seen the replies to this bug which seems to be posted by you?If those solutions work,do write an answer.If not,make an edit explaining why/how it didn't. – Registered User Feb 9 '14 at 11:19
  • @adityapatil: no, this bug was not posted by me. Note that it dates back over a year ago. The solution posted do not work for me, since those are crontab related issues. It also fails by manual execution. I have however implemented it (see link in the OP), but as expected, it didn't change anything. – stebu92 Feb 9 '14 at 11:28
  • have you tried variety? It's worth trying software(though in my case it started an rare dbus-deamon bug).try sudo apt-get install variety – Registered User Feb 9 '14 at 11:36

Trying a little bit and reading about the bug I figured out a really simple workaround.

You will have to sandwitch your "picture-url" command disabling and enabling againg the draw-background entry. Basically, your line should look like this:

gsettings set org.gnome.desktop.background draw-background false && gsettings set org.gnome.desktop.background picture-uri file:///home/$USER/Imágenes/pic.jpg && gsettings set org.gnome.desktop.background draw-background true

I've just made a one-liner that do gsettings set org.gnome.desktop.background draw-background false change the wall and then activate the entry again. :)

It works like a charm! Thanks for the question! ^_^

| improve this answer | |
  • Thanks for your answer. I have implemented it, but unfortunately the problem persists... – stebu92 Feb 9 '14 at 12:31
  • do you have any message when running the command? did you tried disabling permanently the draw background feature? – Rho Feb 9 '14 at 12:34
  • No there is no message. I'm not quite sure what you mean, but i set the draw background to false an then tried to change it again. There is some kind of animation going on that indicates that it attempts to change the background. However it does not. – stebu92 Feb 9 '14 at 12:38
  • ok then. I'll guess it might be a problem with the file addresses. Try to rename two files, put them in your /home/user/1.png /home/user/2.png and see if that's working. the entry should be file:///home/$USER/1.png and 2.png. – Rho Feb 9 '14 at 13:32
  • Thats indeed the problem! Thank you very much. It seems as if gnome caches the image. I marked your answer as accepted, but i couldn't upvote it =) – stebu92 Feb 9 '14 at 16:33

I had this problem too, in my case it turned out that X file handles were leaking and eventually ran out (I changed my wallpaper every 15 mins).

Solution was:

gsettings set org.gnome.desktop.background picture-uri ""
wget https://path/to/image.jpg -O ~/wp.jpg
gsettings set org.gnome.desktop.background picture-uri "file:///home/me/wp.jpg"

Unsetting and then setting the wallpaper solved the issue.

| improve this answer | |

Seems like a known bug:


Hope this helps!

More information: https://stackoverflow.com/questions/10374520/gsettings-with-cron/19666729#19666729

| improve this answer | |
  • Thanks for your answer, Wolfgang. However your links address the same issue as the one linked in the OP. Implementing those did not solve my problem, unfortunately, since it does not seem to be related to crontab. – stebu92 Feb 9 '14 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.