FS#23706 - cron feh background display

Attached to Project: Arch Linux
Opened by Tri Le (tri1976) - Monday, 11 April 2011, 17:41 GMT
Last edited by Gaetan Bisson (vesath) - Tuesday, 12 April 2011, 13:07 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Gaetan Bisson (vesath)
Architecture i686
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

https://bbs.archlinux.org/viewtopic.php?id=116638
I use feh to set the desktop background and cron to change it every hour. The following command
DISPLAY=:0 feh --bg-scale /home/tri/.wallpaper
used to work, but recently stop working. The cron log show the following error "feh ERROR: Can't open X display. It *is* running, yeah?" X is running, "echo $DISPLAY" shows ":0", and execute the command in shell works. One of the users in the forum suggested there might be a bug with giblib/feh and cron.
feh 1.12
giblib 1.2.4
dcron 4.4
This task depends upon

Closed by  Gaetan Bisson (vesath)
Tuesday, 12 April 2011, 13:07 GMT
Reason for closing:  Not a bug
Comment by Gaetan Bisson (vesath) - Monday, 11 April 2011, 18:22 GMT
Install xorg-xsetroot, put "DISPLAY=:0 xsetroot" as a cron job, and see if your root window becomes black. If it does not, the problem is not with feh.
Comment by Tri Le (tri1976) - Monday, 11 April 2011, 23:41 GMT
"DISPLAY=:0 xsetroot" as a cron job works...the root window becomes black.
Comment by Gaetan Bisson (vesath) - Tuesday, 12 April 2011, 06:32 GMT
Alright.

Here, doing `echo '*/1 * * * * DISPLAY=:0 feh --bg-scale ~/wtf.jpg' | crontab -` works and sets wtf.jpg as a wallpaper.

Could you check your cron command as it appears in /var/spool/cron/?

Edit: Also, can you show us the content of /var/log/crond.log?
Comment by Tri Le (tri1976) - Tuesday, 12 April 2011, 12:24 GMT
I put the wallpaper changing script (feh command) in /etc/cron.hourly and that where the problem is. When I put the script in "crontab -e" as user logged into X, it works. I guess when I'm logged into X as a regular user and run the script as root, it doesn't recognize that X is running. A recent update must have changed this behavior because it used to work before. I guess you can mark this as solved. Thanks.
Comment by Gaetan Bisson (vesath) - Tuesday, 12 April 2011, 12:43 GMT
To make it work as root, use `HOME=/home/tri DISPLAY=:0 command` so that root borrows your Xauthority magic cookie.
Comment by Tri Le (tri1976) - Tuesday, 12 April 2011, 12:57 GMT
Thank you. That works too.

Loading...