Setting the desktop background from cron no longer updates the desktop background

Bug #1033034 reported by Serrano Pereira
32
This bug affects 7 people
Affects Status Importance Assigned to Milestone
nautilus (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I wrote a script which uses `gsettings` to change the desktop background in Gnome Shell/Unity. The command that my script executes looks like this:

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

Manually running this command immediately updates the desktop background. I use cron to schedule execution of my script. My crontab rule looks like this:

    0,30 * * * * DISPLAY=:0.0 nextwall /home/serrano/Pictures/backgrounds/

Cron successfully runs the script every 30 minutes and the new wallpaper URI is successfully set in `gsettings`. I test this by running:

    gsettings get org.gnome.desktop.background picture-uri

However, the desktop background is not updated when cron runs the script (this used to work until about a month ago). Interestingly, when I right click on my desktop and select "Change Desktop Background", the desktop background is suddenly updated to the correct image.

So for some reason changing the desktop background from cron no longer triggers nautilus to update the desktop background.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: nautilus 1:3.4.2-0ubuntu4
ProcVersionSignature: Ubuntu 3.2.0-29.46-generic-pae 3.2.24
Uname: Linux 3.2.0-29-generic-pae i686
NonfreeKernelModules: nvidia
ApportVersion: 2.0.1-0ubuntu12
Architecture: i386
Date: Sat Aug 4 13:09:50 2012
GsettingsChanges:
 org.gnome.nautilus.window-state geometry '887x481+231+101'
 org.gnome.nautilus.window-state maximized true
 org.gnome.nautilus.window-state sidebar-width 158
 org.gnome.nautilus.window-state start-with-status-bar true
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release i386 (20120423)
SourcePackage: nautilus
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Serrano Pereira (serrano-pereira) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nautilus (Ubuntu):
status: New → Confirmed
Revision history for this message
Serrano Pereira (serrano-pereira) wrote :

The last few days this problem has become less predictable. Instead of every day, this problem occurs every other day. I'm not experiencing the issue today, but yesterday I did.

Revision history for this message
Bryan Sills (bryan-a-sills) wrote :

Another way to trigger the wallpaper to change is to go into dconf and toggle the draw-background checkbox in org.gnome.desktop.background.

Revision history for this message
O. Garcia (tartarianspawn) wrote :

I see this has been here a while, but I had the same issue a few days ago and was able to resolve it by adding the following to the command:

DISPLAY=:0 GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.background picture-uri file:///path/to/background.jpg

Revision history for this message
Serrano Pereira (serrano-pereira) wrote :

Thanks for the suggestions. The issue became less and less frequent until when a few months ago it somehow resolved itself. I didn't do anything though; the script and the cron command have remained the same.

Revision history for this message
Radu Rădeanu (radu-radeanu) wrote :

The croc will change the desktop background if you add in your script before `gsettings` the following lines/commands:

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

You will not need anymore to use in your crontab rule `DISPLAY=:0`.

More explanations here: http://stackoverflow.com/a/19666729/2353900

Changed in nautilus (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.