2

I've created a neat little script that downloads a JPG using wgetand then sets it as the Unity desktop background with

gsettings set org.gnome.desktop.background picture-uri file:///home/myname/wallpaper.jpg

After running the script, the desktop wallpaper is incomplete but when I open the downloaded image, it is fine! When I manually run the gsettings command, the same thing happens - so I don't think the problem could be that gsettings starts before the image is downloaded completely.

What is causing this odd problem, and how can I fix it?

  • Exhibit A: my neat little script.
  • Exhibit B: My desktop with an incomplete background image:
    enter image description here.
  • Exhibit C: original image url. The trick is that this URL is static but the actual image file is continually refreshed with a different image file. That's why I made my script.
  • Exhibit D: When the desktop is broken, manually setting the wallpaper through the Settings GUI (or desktop right-click) fixes it ... until the cron'ed script runs again.
  • Exhibit E: When the desktop is broken, manually running gsettings set org.gnome.desktop.background picture-uri file:///home/myname/wallpaper.jpg doesn't fix it.
  • Exhibit F: When the desktop is broken, manually running gsettings set org.gnome.desktop.background picture-options zoom doesn't fix it. Nothing seems to happen.
  • Exhibit G: When the desktop is broken, the cached wallpaper is also broken. I came across this very similar topic. Adding rm of the cached file before the gsettings command doesn't solve my problem though; the new cached image is broken too. It almost seems like that gsettings command is broken?
  • Does th wallpaper load correctly when you change to it via GUI (my guess is no)? – Jacob Vlijm Feb 27 '15 at 11:26
  • Yes that works too! – Torben Gundtofte-Bruun Feb 27 '15 at 11:57
  • To get it clear, if you run (only) gsettings set org.gnome.desktop.background picture-uri file:///home/myname/wallpaper.jpg on the downloaded file, it appears only half? – Jacob Vlijm Feb 27 '15 at 12:04
  • Yes, correct @JacobVlijm. (I'm on 14.10). – Torben Gundtofte-Bruun Feb 27 '15 at 12:06
  • 1
    I also get partial image and noticed that the image is drawn dynamically as if the file is downloading (but it has downloaded already). Perhaps, if you put a wait time after download and before the gsetting, then you may get the full image. – Sri Feb 28 '15 at 7:57
1

If your purpose is to display the current earth view, you might make use of xplanet, which gets a more frequently updated image.

Install xplanet with -

sudo apt-get install xplanet

Then, in your script replace the image source with the xplanet output as below.

xplanet -body earth -num_times 1 -projection mercator -output $wallpaper_name -geometry 1366x768
(replace geometry parameter value with your screen size).

Now, you will get a more frequently updated image that won't be sliced.

| improve this answer | |
  • There's a program that generates these and can be run on the local computer? How cool is that! I'll never not be surprised by the versatility of Linux :D – Torben Gundtofte-Bruun Feb 28 '15 at 7:56
  • Yes, xplanet can run a continuous image update, however your script will allow a more judicious use of personal computer resource. A cron with 15 minute update interval is quite appropriate for personal use :) – Sri Feb 28 '15 at 8:01
  • Your answer doesn't explain the cause of my current problem but provides a fine alternative solution that I want to implement. Thank you! – Torben Gundtofte-Bruun Feb 28 '15 at 8:02
  • Thanks to you too. I changed my desktop/wallpaper to this interesting journey through the day. – Sri Feb 28 '15 at 8:06
  • Now having toyed with xplanet I can't decide whether to use it or not. It does produce a very nice image but the nighttime area seems wrong - too bright and missing city lights. For that, the Opentopia images win. Hmm... – Torben Gundtofte-Bruun Feb 28 '15 at 18:40

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.