snippets / background

All snippets tagged background (1)

  1. change aléatoirement le fond d'écran de gnome

    le fichier /tmp/picture_bg contient l'historique des fonds d'écrans utilisés.

     1 #! /bin/bash
    2
    3 # can be : none wallpaper stretched scaled centered
    4 picture_options="scaled"
    5
    6 bgpath="${1:-/home/mobidyc/perso/artgallery/desktop/}"
    7 num="0"
    8 total_pix="0"
    9 pix_tmp="${2:-/tmp/rotate_background_gnome.tmp}"
    10
    11 find $bgpath ! -type d > ${pix_tmp}
    12 if [[ "$?" != "0" ]]
    13 then
    14 echo "$(basename) - find est tombe en erreur"
    15 exit 1
    16 fi
    17
    18 total_pix="$(wc -l ${pix_tmp} | awk '{print $1}')"
    19 if [[ "$?" != "0" ]]
    20 then
    21 echo "$(basename) - wc est tombe en erreur"
    22 exit 1
    23 fi
    24
    25 let rand_pic="${RANDOM}%${total_pix}"
    26
    27 while read picture_bg
    28 do
    29 num="$((${num}+1))"
    30 if [[ "${num}" = "${rand_pic}" ]]
    31 then
    32 /usr/X11R6/bin/gconftool-2 --type string --set /desktop/gnome/background/picture_filename "${picture_bg}"
    33 test "$?" = "0" && {
    34 echo "$(date): ${picture_bg}" >> /tmp/picture_bg
    35 }
    36 /usr/X11R6/bin/gconftool-2 --type string --set /desktop/gnome/background/picture_options "${picture_options}"
    37 fi
    38 done <${pix_tmp}
    39
    40 rm $pix_tmp
    41
    42 exit 0
showing 10, 25, 50 items per pages

Pages : 1

Flux RSS friendsnippetLatest snippets


More...