You are not logged in.

#1 2011-04-10 20:26:17

tri1976
Member
Registered: 2009-09-07
Posts: 152

cron feh background display [SOLVED]

I use feh to set the desktop background and cron to change it every hour.  The following command

DISPLAY=:0.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  and "echo $DISPLAY" shows ":0"  I'm wondering if anyone is experiencing this issue.

Last edited by tri1976 (2011-04-29 20:24:18)

Offline

#2 2011-04-10 21:10:37

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: cron feh background display [SOLVED]

Why use a cron job?

I just execute this script:
wallpaper.sh

#!/bin/bash

shopt -s nullglob

cd ~/.wallpaper

while true; do
        files=()
        for i in *.jpg *.png; do
                [[ -f $i ]] && files+=("$i")
        done
        range=${#files[@]}

        ((range)) && feh --bg-fill "${files[RANDOM % range]}"

        sleep 15m
done

xinitrc:

. ~/.wallpaper/wallpaper.sh &

.wallpaper is my wallpaper directory.  Just replace that with whatever directory you are using for your wallpaper and it should work.

Last edited by the sad clown (2011-04-10 21:11:24)


I laugh, yet the joke is on me

Offline

#3 2011-04-10 21:21:22

tri1976
Member
Registered: 2009-09-07
Posts: 152

Re: cron feh background display [SOLVED]

running a script in the background is an alternative, but I'd still like to find out why it no longer works.  Since cron is already running in the background for other things, I thought it would be more efficient to use it.

Offline

#4 2011-04-10 21:32:58

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: cron feh background display [SOLVED]

Sorry, can't help you with that.


I laugh, yet the joke is on me

Offline

#5 2011-04-10 21:50:38

iimblack
Member
Registered: 2011-03-04
Posts: 16

Re: cron feh background display [SOLVED]

I don't really know too much but is there a difference between :0 and :0.0?

Offline

#6 2011-04-10 21:58:09

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: cron feh background display [SOLVED]

Have you tried issuing the command from shell and see if it has the same error?


I laugh, yet the joke is on me

Offline

#7 2011-04-10 21:58:24

tri1976
Member
Registered: 2009-09-07
Posts: 152

Re: cron feh background display [SOLVED]

I tried both already but none of them work sad

Offline

#8 2011-04-10 22:02:19

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: cron feh background display [SOLVED]

So, the command doesn't work in shell?


I laugh, yet the joke is on me

Offline

#9 2011-04-10 23:16:12

tri1976
Member
Registered: 2009-09-07
Posts: 152

Re: cron feh background display [SOLVED]

it does work in shell.

Offline

#10 2011-04-10 23:42:18

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: cron feh background display [SOLVED]

It might be a bug with giblib/feh and cron.  giblib was recently updated (4/6) and feh about a month before that.  "DISPLAY=:0" ought to have set the environment for feh, but is apparently not being recognized by feh or else somehow superceded by cron which operates at a lower level than X.


I laugh, yet the joke is on me

Offline

#11 2011-04-10 23:54:53

tri1976
Member
Registered: 2009-09-07
Posts: 152

Re: cron feh background display [SOLVED]

@the sad clown, thanks for the insight.  I wonder if developers are aware of this.  Perhaps, I should file a bug on the issue

Offline

#12 2011-04-11 23:49:35

tri1976
Member
Registered: 2009-09-07
Posts: 152

Re: cron feh background display [SOLVED]

I try "DISPLAY=:0 xsetroot" as a cron job and it works...the root window becomes black.  So the problem appears to be with feh.

Offline

#13 2011-04-12 00:52:09

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: cron feh background display [SOLVED]

Congratulations on the fix.  How did you figure it out?


I laugh, yet the joke is on me

Offline

#14 2011-04-12 00:54:36

tri1976
Member
Registered: 2009-09-07
Posts: 152

Re: cron feh background display [SOLVED]

It's not fixed yet.  I just confirm that the problem is with feh not cron.

Offline

#15 2011-04-12 01:44:29

tri1976
Member
Registered: 2009-09-07
Posts: 152

Re: cron feh background display [SOLVED]

[SOLVED]
I put the wallpaper changing script in /etc/cron.hourly and that where the problem is.  When I put the script in "crontab -e", it works.

Offline

#16 2011-04-12 02:57:59

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: cron feh background display [SOLVED]

Great.  Don't forget to edit the title of the thread to mark it [SOLVED] as well.


I laugh, yet the joke is on me

Offline

#17 2011-04-12 12:12:01

tri1976
Member
Registered: 2009-09-07
Posts: 152

Re: cron feh background display [SOLVED]

where do I go to edit the thread title...I don't think I have permission to do so.

Offline

#18 2011-04-12 13:39:22

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: cron feh background display [SOLVED]

Just edit your first post.


To know or not to know ...
... the questions remain forever.

Offline

Board footer

Powered by FluxBB