Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Set background depending on time, weather, season...
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
da_monumental_1
n00b
n00b


Joined: 20 Jan 2005
Posts: 18

PostPosted: Tue Aug 16, 2005 3:47 am    Post subject: Reply with quote

Anyone set this up to work with gnome?
Back to top
View user's profile Send private message
larspaul
n00b
n00b


Joined: 13 Jun 2004
Posts: 4

PostPosted: Tue Aug 16, 2005 12:35 pm    Post subject: Reply with quote

Have you ever thought about that the sun doesnt sets and rise at the same time the entire year?
You should include that in you script, i don't know any python so i can't. :cry:
Back to top
View user's profile Send private message
Hydraulix
Guru
Guru


Joined: 12 Dec 2003
Posts: 447
Location: Baltimore, Maryland

PostPosted: Mon Sep 05, 2005 7:41 pm    Post subject: Reply with quote

I still get the same error.
_________________
It is the fate of operating systems to become free.
- Neal Stephenson

If only You and Dead people can read hex, how many people can read hex?
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Thu Sep 08, 2005 4:11 am    Post subject: Reply with quote

Hydraulix wrote:
I still get the same error.

onewithnature requires at least one argument, namely the name of a directory within your wallpapers directory
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Thu Sep 08, 2005 4:11 am    Post subject: Reply with quote

larspaul wrote:
Have you ever thought about that the sun doesnt sets and rise at the same time the entire year?
You should include that in you script, i don't know any python so i can't. :cry:

Alright, this should be fun...

EDIT: see my new post below, I consolidated everything into a single python script

Code:
emerge -u atd
rc-update add atd default
/etc/init.d/atd start

cd /usr/local/src
wget http://freshmeat.net/redir/sunwait/47299/url_tgz/sunwait-20041208.tar.gz
tar xvzf sunwait-20041208.tar.gz
cd sunwait-20041208
make
mv sunwait /usr/local/bin

Now edit /usr/local/bin/sun and paste the following:
Code:
#!/bin/bash

LOCATION="43.069886N 89.407534W"
SUN="/usr/local/bin/sunwait -p $LOCATION"

case $1 in
    "rise")
        $SUN | awk '/rises/ {print $3}'
    ;;
    "set")
        $SUN | awk '/rises/ {print $6}'
    ;;
    "noon")
        $SUN | awk '/meridian/ {print $4}'
esac

Set LOCATION to your coordinates (in the US, try this site)

Now you can make yourself a script to run once daily from cron. Here is an example, I saved it as /usr/local/bin/makenature :
Code:
#!/bin/bash
SUN=/usr/local/bin/sun
COMMAND='pgrep -x X >&/dev/null && /usr/local/bin/onewithnature'

echo "$COMMAND morning >&/dev/null"   | at `$SUN rise` + 10 minutes; sleep 1
echo "$COMMAND mid-day >&/dev/null"   | at `$SUN noon` - 1 hour; sleep 1
echo "$COMMAND afternoon >&/dev/null" | at `$SUN noon` + 1 hour; sleep 1
echo "$COMMAND sunset >&/dev/null"    | at `$SUN set` - 20 minutes; sleep 1
echo "$COMMAND evening >&/dev/null"   | at `$SUN set` + 40 minutes

( Replace /usr/local/bin/onewithnature with wherever you put the OP's script )

Of course you can adjust the +/- minutes and hours to suit your tastes.

Don't forget the executable permissions for the scripts:
Code:
cd /usr/local/bin; chmod 755 sun makenature onewithnature

To start makenature at boot, append this line to /etc/conf.d/local.start :
Code:
su USERNAME /usr/local/bin/makenature >&/dev/null

(where USERNAME is the name of the user that will be running X)
Finally, in your USERNAME's crontab you'll only need one line:
Code:
        1       0       *       *       *       /usr/local/bin/makenature

_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?


Last edited by Dlareh on Thu Sep 08, 2005 1:25 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Thu Sep 08, 2005 12:17 pm    Post subject: Reply with quote

New python version 0.3 is out, see below...
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?


Last edited by Dlareh on Sat Sep 17, 2005 4:25 am; edited 1 time in total
Back to top
View user's profile Send private message
grenouille
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2004
Posts: 97

PostPosted: Sat Sep 17, 2005 2:30 am    Post subject: Reply with quote

very nice! thanks :D
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Sat Sep 17, 2005 4:25 am    Post subject: Reply with quote

Quote:
very nice! thanks :D
Yay, someone cares... here is the new 0.3 release, code-named grenouille ;)

Installation -- If this is your first time trying naturalbg, you will need to:
Code:
emerge -u atd pymetar
rc-update add atd default
/etc/init.d/atd start

cd /usr/local/src
wget http://freshmeat.net/redir/sunwait/47299/url_tgz/sunwait-20041208.tar.gz
tar xvzf sunwait-20041208.tar.gz
cd sunwait-20041208
make
mv sunwait /usr/local/bin

The version 0.3 stuff :
Code:
cd /usr/bin; [ -x fbsetbg ] || wget http://www.khk.org/files/fbsetbg && chmod 755 fbsetbg
cd /usr/local/bin; wget http://www.khk.org/files/naturalbg && chmod 755 naturalbg
$EDITOR naturalbg  #  configure settings . . .

Fbsetbg is the default wallpaper setter, but you can use any one you like. It is a wrapper script taken from fluxbox that should work with any windowmanager, and is not needed if you already have fluxbox installed or would like to use something else instead.

Changelog:

- code to detect if an at job has already been scheduled, to avoid scheduling simultaneous changes
- random wallpaper choosing now done internaly instead of fbsetbg -r, so fbsetbg -l can restore previous wallpaper on X restart

feedback welcome as usual
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum