Hirdetés

Új hozzászólás Aktív témák

  • utgyuru

    aktív tag

    Üdv!

    Gnome-on szeretném megcsinálni, hogy a háttérkép változzon időközönként, mint a Windows 7-ben. Egy külföldi fórumon találtam is egy szkriptet, íme:

    #!/bin/bash
    WALLPAPERS=~/wallpapers

    # find the identity of the current wallpaper...
    # get the name...
    THISONE=`gconftool-2 -g /desktop/gnome/background/picture_filename`

    # Chop off the path
    THISONE=${THISONE##*/}

    # locate the filename by index in this directory
    THISONE=`ls -1 $WALLPAPERS | grep -n $THISONE`

    # make the grep string into a valid number
    THISONE=0${THISONE%%:*}

    # get a directory list
    ALIST=( `ls -1 $WALLPAPERS` )

    # get the number of lines in that list
    RANGE=${#ALIST[@]}

    # programmers trick to make a 'while' loop that runs at least once...
    lastnum=1
    number=1

    while [[ "$lastnum" -eq "$number" ]]; do
    # Now randomize until we have a new number that is not the same as the old one...
    let lastnum=$THISONE
    let "number = $RANDOM + $lastnum"
    let "number = $number % $RANGE"
    done

    # Set wallpaper to selection indexed by new "number"
    gconftool-2 -t string -s /desktop/gnome/background/picture_filename $WALLPAPERS/${ALIST[$number]}

    # Uncomment next two lines if you want to make a wallpaper switcher you can set your clock by,..
    sleep 60 #change this to the number of seconds you want between changes
    $WALLPAPERS/.randomwallpaper.sh

    Műküdik is, váltogatja a képeket, a gondom annyi vele, hogy néha kép helyett egy teljesen zöld hátteret kapok. A megadott idő elteltével ezt a zöld hátteret ugyanúgy váltja, és megint jönnek a képek. Valaki tudna segíteni, ezt hogyan lehet kiküszöbölni?

Új hozzászólás Aktív témák