Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index International Gentoo Users Deutsches Forum (German) Deutsche Dokumentation
  • Search

[HOWTO] Zufälliges Hintergrundbild setzen.

Dokumentation, Tipps und Tricks.
Post Reply
  • Print view
Advanced search
1 post • Page 1 of 1
Author
Message
OnoSendai
n00b
n00b
User avatar
Posts: 55
Joined: Sat Aug 14, 2004 11:41 am
Location: Berlin

[HOWTO] Zufälliges Hintergrundbild setzen.

  • Quote

Post by OnoSendai » Sat Mar 11, 2006 3:09 pm

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

#!/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.
Top
Post Reply
  • Print view
1 post • Page 1 of 1

Return to “Deutsche Dokumentation”

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