Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] Zufälliges Hintergrundbild setzen.
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Deutsche Dokumentation
View previous topic :: View next topic  
Author Message
OnoSendai
n00b
n00b


Joined: 14 Aug 2004
Posts: 55
Location: Berlin

PostPosted: Sat Mar 11, 2006 3:09 pm    Post subject: [HOWTO] Zufälliges Hintergrundbild setzen. Reply with quote

Ich hab eben ein kleines Miniskript geschrieben, daß ein Hintergrundbild zufällig auswählt, und nach einer bestimmten Zeit ein neues setzt.

Vielleicht findet das jemand nützlich..

Wichtig:
Natürlich sollte WALLPAPERDIR angepasst werden. sonst klappt es nicht.. ;-)

Und falls jemand nicht WindowMaker als Fenstermanager benutzt (solls ja geben, auch wenn ich das nicht verstehe), sollte der Usabilityfeind natürlich auch das WALLPAPERSETCOMMAND anpassen. ;-)

Code:
#!/bin/bash

EXIT_SUCCESS=0
EXIT_FAILURE=1

# Verzeichniss in dem die Hintergrundbilder liegen (Unbedingt anpassen!):
WALLPAPERDIR="/home/hp/.wallpaper"

# Programm mit dem man die Bilder als Hintergrund setzt:
WALLPAPERSETCOMMAND="wmsetbg -u -t "

# Zeit, bis ein neues Hintergrundbild gesetzt wird:
ZEIT="60m"


function setwallpaper {

        cd $WALLPAPERDIR
               
        # alle Dateien in eine Liste schreiben:
        ls > list

        # Anzahl der Dateien ausgeben:
        ANZAHL=`wc -l list | tr -d [:alpha:]`
       
        # Eine zufällige Zahl zwischen 1 und Anzahl der Dateien:
        LINIE_TMP=`expr $RANDOM % $ANZAHL`
        LINIE=`expr $LINIE_TMP + 1`
       
        # Datei Auswählen:
        WALLPAPER=`head -n $LINIE list | tail -n 1`

        # Datei als Hintergrund setzen:
        $WALLPAPERSETCOMMAND $WALLPAPER
       
        echo $WALLPAPER "als Hintergrund gesetzt"
       
        rm list
        cd -
}

while [ "$ZEIT" == "$ZEIT" ]
do
        setwallpaper
        sleep $ZEIT
done

exit $EXIT_SUCCESS

_________________
Wintermute was a simple cube of white light, that very simplicity suggesting extreme complexity.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Deutsche Dokumentation All times are GMT
Page 1 of 1

 
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