Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

HOWTO: Set background depending on time, weather, season...

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
33 posts
  • Previous
  • 1
  • 2
Author
Message
da_monumental_1
n00b
n00b
Posts: 18
Joined: Thu Jan 20, 2005 10:43 pm

  • Quote

Post by da_monumental_1 » Tue Aug 16, 2005 3:47 am

Anyone set this up to work with gnome?
Top
larspaul
n00b
n00b
Posts: 4
Joined: Sun Jun 13, 2004 4:06 pm

  • Quote

Post by larspaul » Tue Aug 16, 2005 12:35 pm

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:
Top
Hydraulix
Guru
Guru
User avatar
Posts: 447
Joined: Fri Dec 12, 2003 4:28 am

  • Quote

Post by Hydraulix » Mon Sep 05, 2005 7:41 pm

I still get the same error.
It is the fate of operating systems to become free.
- Neal Stephenson
Top
Dlareh
Advocate
Advocate
User avatar
Posts: 2102
Joined: Sat Aug 06, 2005 8:33 pm

  • Quote

Post by Dlareh » Thu Sep 08, 2005 4:11 am

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?
Top
Dlareh
Advocate
Advocate
User avatar
Posts: 2102
Joined: Sat Aug 06, 2005 8:33 pm

  • Quote

Post by Dlareh » Thu Sep 08, 2005 4:11 am

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: Select all

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: Select all

#!/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: Select all

#!/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: Select all

cd /usr/local/bin; chmod 755 sun makenature onewithnature
To start makenature at boot, append this line to /etc/conf.d/local.start :

Code: Select all

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: Select all

        1       0       *       *       *       /usr/local/bin/makenature
Last edited by Dlareh on Thu Sep 08, 2005 1:25 pm, edited 1 time in total.
"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?
Top
Dlareh
Advocate
Advocate
User avatar
Posts: 2102
Joined: Sat Aug 06, 2005 8:33 pm

  • Quote

Post by Dlareh » Thu Sep 08, 2005 12:17 pm

New python version 0.3 is out, see below...
Last edited by Dlareh on Sat Sep 17, 2005 4:25 am, edited 1 time in total.
"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?
Top
grenouille
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 97
Joined: Sat Jun 12, 2004 6:45 pm

  • Quote

Post by grenouille » Sat Sep 17, 2005 2:30 am

very nice! thanks :D
Top
Dlareh
Advocate
Advocate
User avatar
Posts: 2102
Joined: Sat Aug 06, 2005 8:33 pm

  • Quote

Post by Dlareh » Sat Sep 17, 2005 4:25 am

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: Select all

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: Select all

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?
Top
Post Reply

33 posts
  • Previous
  • 1
  • 2

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic