Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 22/03/2008, à 14:43

Darel

[scripts] - 4 petits scripts fait maison !

Salut !

Quand je me fais CH**R sur mon Tux, je bidouille un peu.
Résultat, 3 petits scripts pour nautilus (http://doc.ubuntu-fr.org/nautilus_scripts) !

----------------------------------------- NAUTILUS SCRIPTS -----------------------------------------
1) COMPRESSER UNE IMAGE
Il sert à compresser une image pour l'envoyer sur Internet grâce à Imagemagick (http://doc.ubuntu-fr.org/imagemagick).
Le tout en interface graphique avec zenity, et en seulement 2 étapes.

2) OUVRIR LE DOSSIER EN TANT QUE "ROOT"
Là, rien de très original, petit script reprit à ma sauce.

3) OUVRIR UN TERMINAL ICI
Idem que le 2.

----------------------------------------- SCRIPT -----------------------------------------
1) FOND D'ÉCRAN ALEATOIRE
Un petit script bash qui peut être lancé au démarrage en l'ajoutant aux SESSIONS (Système > Préférences > Sessions), ou tous simplement en le lançant normalement.
Les fond d'écrans doivent être au format JPEG (*.jpg) BMP (*.bmp) ou PNG (*.png), ne pas comporter d'espaces dans les noms de fichier et être placer dans le dossier "wallpers" situé dans votre dossier personnel.
Pour que le script fonctionne, remplacez à la ligne 12 du script "user" par votre nom d'utilisateur.

Pour les télécharger: http://404upload.fr/fichier-0135056001206355676.html

Voilà, si vous avez d'autres idées ou des améliorations sympathiques en tête...

Dernière modification par Darel (Le 24/03/2008, à 11:53)


Quand la société serre les fesses, les espaces de liberté individuelle rétrécissent.
Roland Topor.

Hors ligne

#2 Le 23/03/2008, à 06:14

beinuo21

Re : [scripts] - 4 petits scripts fait maison !

J'ai testé le script pour redimensionner une image, c'est très pratique! -->adopté

Merki!;)


Sony VAIO VGN-FZ21E : Core2duo T7250 - 2GbRam - 32Gb SSD Samsung SLC - nVidia 8400GS (éternel problème d'écran noir au démarrage, please help!)

Hors ligne

#3 Le 23/03/2008, à 08:22

Darel

Re : [scripts] - 4 petits scripts fait maison !

Merci big_smile .
Le seul problème c'est qu'il ne peux traiter qu'une seule image à la fois.
(La flemme, pour faire sa sur plusieurs images, XnView existe lol )

Dernière modification par Darel (Le 24/03/2008, à 11:57)


Quand la société serre les fesses, les espaces de liberté individuelle rétrécissent.
Roland Topor.

Hors ligne

#4 Le 24/04/2008, à 13:33

MrKikkeli

Re : [scripts] - 4 petits scripts fait maison !

Dans la veine du fond d'écran aléatoire, j'ai développé quelques scripts qui récupèrent des images d'une webcam pour en faire mon fond d'écran. C'est une alternative à l'utilisation de xwinwrap (ne marche pas sur mon eee pc) ou à l'utilisation de mplayer avec l'option rootwin (permet d'avoir une  vidéo en fond d'écran,  mais désactive la prise en charge graphique du bureau par gnome et nautilus).

Voici le script général (exemple pour une caméra pointant sur shibuya, un quartier animé de Tôkyô):

#!/bin/sh

# Static webcam as a wallpaper in gnome v 0.20080418
# Script by MrKikkeli -04.18.08

# we kill first any other static webcam wallpaper process that is currently running,
# otherwhise there will be some mean concurrency
# Make sure all your scripts' names end with webcamwallpaper.sh

for process_to_kill in `ps -ef | grep webcamwallpaper.sh | grep -v $$ | grep -v grep | awk '{print $2}'`; do
kill -1 ${process_to_kill} >> /dev/null;
done

# body

while [ 1 ]; do
rm -f /tmp/bg-*.jpg;
IMAGE=/tmp/bg-`date +%s`.jpg;
nice wget http://shibuya02.ipcam.jp/SnapshotJPEG --post-data 'Resolution=160x120&Quality=High' -O $IMAGE;
gconftool -t string -s /desktop/gnome/background/picture_filename $IMAGE;
sleep 1;
done;

La première partie du script vérifie qu'aucun autre script du même type n'est en train de tourner (sinon  votre fond d'écran va "clignoter"), ce qui permet de lancer vos scripts comme vous voulez. Bien sûr cela ne marche qu'à condition de nommer tous vos scripts de webcam "blablabla-webcamwallpaper.sh" .
Pour adapter le script à vos propres webcams, il suffit de mettre l'URL de la prise de vue après wget, et éventuellement les arguments POST après "post-data"; et de changer le paramètre derrière "sleep" en fonction du taux de rafraîchissement de la webcam.

Autre exemple d'application : le fond  d'écran qui montre la Terre vue de l'espace en temps réel (ou presque, personne n'a encore hacké les satellites militaires)

Il faut installer au préalable xplanet xplanet-data .

#!/bin/sh

# Static webcam as a wallpaper in gnome v 0.20080418
# Script by MrKikkeli -04.18.08

# we kill first any other static webcam wallpaper process that is currently running,
# otherwhise there will be some mean concurrency
# Make sure all your scripts' names end with webcamwallpaper.sh

for process_to_kill in `ps -ef | grep webcamwallpaper.sh | grep -v $$ | grep -v grep | awk '{print $2}'`; do
kill -1 ${process_to_kill} >> /dev/null;
done

# body

while [ 1 ]; do
rm -f /tmp/bg-*jpg;
IMAGE=/tmp/bg-`date +%s`.jpg;
nice xplanet -num_times 1 -output $IMAGE -geometry 800x600 -longitude 2 -latitude 48;
gconftool -t string -s /desktop/gnome/background/picture_filename $IMAGE;
sleep 300
done;

Changez la résolution (argument de geometry) et les coordonnées du point de vue (là, ça pointe sur Paris grosso modo) selon votre convenance.

Et pour fêter l'arrivée de Hardy, j'ajoute un script qui choisit aléatoirement un script à faire tourner, si comme moi vous vous retrouvez avec des centaines de cams et ne savez plus que choisir ...

#!/bin/sh

# Create an array of the files
files=(`ls *webcamwallpaper.sh`)

# Get the size of the array
N=${#files[@]}

while [ 1 ]; do
# Select a random number between this range
((M=RANDOM%N))
# Get the name of this file
randomfile=`echo ${files[$M]}`
sh $randomfile &
sleep 3600
done;

Attention, sans que je sache trop pourquoi, ce script ne s'exécute correctement qu'invoqué avec bash, et non sh.

Dernière modification par MrKikkeli (Le 24/04/2008, à 18:12)

Hors ligne

#5 Le 25/04/2008, à 02:11

MrKikkeli

Re : [scripts] - 4 petits scripts fait maison !

Sous hardy, mes scripts ne marchent plus hmm Le fond d'écran devient vide avant chaque mise à jour de l'image. Quelqu'un voit pourquoi ?

Hors ligne

#6 Le 26/04/2008, à 01:42

MrKikkeli

Re : [scripts] - 4 petits scripts fait maison !

up

Hors ligne

#7 Le 29/04/2008, à 16:00

Micnight

Re : [scripts] - 4 petits scripts fait maison !

Désolé je ne vois pas de réponse pour ton problème par contre pour un post un peu plus haut où il ne savait pas comment faire pour redimensionner plusieurs image d'un coup, un traitement par lot.
Voilà un de mes script qui le fait... à utiliser avec nautilus-actions et image-magick

comme option dans nautilus-actions je met:
chemin : chemin vers le script
paramètres : %d %m

voici le script:

#! /bin/bash
IFS=$'\n'
cd $1
shift
for i in $*
do
   #applique la modification de taille
   convert $i -geometry 640x640 -density 150x150 $i
done

Facile à transformer pour d'autre effet que permet image magick comme inverser une image:
convert $i -flop $i


Voilà désolé j'espère que le fait de remonter ton post en même temps va t'aider

Dernière modification par Micnight (Le 29/04/2008, à 17:37)

Hors ligne

#8 Le 29/04/2008, à 19:41

matigol

Re : [scripts] - 4 petits scripts fait maison !

Sinon, avec imagemagick, y a l'option mogrify.

A faire dans le bon dossier. Pas comme moi l'autre fois.

lol

Hors ligne

#9 Le 30/04/2008, à 22:33

MrKikkeli

Re : [scripts] - 4 petits scripts fait maison !

J'ai fait quelques recherches et j'ai fini par trouver l'origine du problème. C'est en fait un bug de gnome qui a été corrigé : le gestionnaire de papier peint ne détectait pas si le fichier du papier peint en cours changeait ...
Résultat, depuis cette correction, fatalement, l'effacement de mon fichier, bien que rapide, était détecté et se traduisait par ce petit "clignotement".

Du coup, il suffit de créer un fichier tampon pour résoudre le pb. Comme j'avais pas envie de modifier à la main mes 80 (!!) scripts shell, j'ai décidé d'en faire un gros et unique script python. Voilà le code :

#! /usr/bin/env python
# -*- coding: utf-8 -*-

##---------------------------------------------------
## Static webcam as a wallpaper in gnome v 0.20080430
## Script by MrKikkeli - 04.30.08
## Turned to Python because it's awesome. :)
##---------------------------------------------------
##---------------------------------------------------
## To do :
##
## - display through a discreet notification which webcam we are watching
## - turn it into a screenlet
## - integrate the xplanet background
##
##---------------------------------------------------

import os, random, urllib, time, sys

##options are :
##    *Resolution would be 160x120 | 320x240 | 640x480
##    *Quality can be 'Clarity', 'Standard' or 'Motion'

snapshotOption = {'Resolution': '640x480', 'Quality': 'Clarity'}

webcam_list = [["http://60.33.165.138:5080/snapshotJpeg",snapshotOption, u"LaundryMat", 0],
               ["http://cam30522.miemasu.net/snapshotJpeg", snapshotOption, u"Tennis Court", 0],
               ["http://kstc.miemasu.net/snapshotJpeg", snapshotOption, u"Tennis Court", 0],
               ["http://82308207.tel.netvolante.jp:8001/snapshotJpeg", snapshotOption, u"Some Appartment", 0],
               ["http://65.13.81.233/snapshotJpeg", snapshotOption, u"Some beach", 0],
               ["http://128.118.52.239/axis-cgi/jpg/image.cgi", {}, u"IST", 0],
               ["http://128.252.39.99/axis-cgi/jpg/image.cgi", {}, u"Some building", 0],
               ["http://napoliwebcam.dnsalias.com/record/current.jpg", {}, u"Napoli", 0],
               ["http://195.243.185.195/axis-cgi/jpg/image.cgi", {}, u"Stuttgart Airport", 0],
               ["http://images.ibsys.com/orl/images/weather/auto/daytonacam_640x480.jpg", {}, u"Daytona Beach", 20],
               ["http://shibuya02.ipcam.jp/SnapshotJPEG", snapshotOption, u"Shibuya", 0],
               ["http://www.acropolis.gr/webcam/acropolis.jpg", {}, u"acropolis", 60],
               ["http://213.253.80.123/still.jpg", {}, u"some airport", 0],
               ["http://www.westphalfamily.com/webcam.jpg", {}, u"altadena", 60],
               ["http://www.borealisbroadband.net/sheraton/sheraton1.jpg", {}, u"anchorage sheraton hotel", 10],
               ["http://192.102.150.10/record/current.jpg", {}, u"aquarium marina oberhausen", 0],
               ["http://142.22.58.150/axis-cgi/jpg/image.cgi", {}, u"aquarium", 0],
               ["http://125.206.34.118/SnapshotJPEG", snapshotOption, u"asakusa", 0],
               ["http://cam6075917.miemasu.net:50006/SnapshotJPEG", snapshotOption, u"barn", 0],
               ["http://biberstein.viewnetcam.com:50000/SnapshotJPEG", snapshotOption, u"Bibi's Webcam", 0],
               ["http://142.36.244.87:8888/SnapshotJPEG", snapshotOption, u"O Canada", 0],
               ["http://88.38.50.59/SnapshotJPEG", snapshotOption, u"Coast", 0],
               ["http://www.gotostjohn.com/live/cruzbay.jpg", {}, u"cruz bay", 30],
               ["http://dake.miemasu.net/snapshotJpeg", snapshotOption, u"dake Ryokan", 0],
               ["http://63.175.189.41/axis-cgi/jpg/image.cgi", {}, u'Deadland', 0],
               ["http://www.parislive.net/eiffelcam3.jpg", {}, u'Tour Eiffel', 10],
               ["http://www.parislive.net/eiffelwebcam1.jpg", {}, u'Tour Eiffel', 10],
               ["http://webmarin.com/images/wc/Camera.jpg", {}, u'Frisco Bay', 10],
               ["http://castrocam.net/castrocam.jpg", {}, u'Frisco Skyline',60],
               ["http://www.stefanome.it/current_lev.jpg", {}, u'Genova', 300],
               ["http://camgodovic.drsc.si/axis-cgi/jpg/image.cgi",{}, u'Godovic', 0],
               ["http://gunnarbu.axiscam.net/axis-cgi/jpg/image.cgi", {}, u'Gunnarbu', 0],
               ["http://www.ek.fi/kamera/tn_palace00.jpg", {}, u'Helsingin Tori', 0],
               ["http://71.254.156.56:8000/axis-cgi/jpg/image.cgi", {}, u'Hermosawave', 0],
               ["http://hih1.dyndns.org:81/record/current.jpg", {}, u'Hih1', 0],
               ["http://82.208.151.76:8000/record/current.jpg", {}, u'hotel unirea Romania',0],
               ["http://webcam.mmhk.cz/axis-cgi/jpg/image.cgi", {}, u'Hradek Kralove', 0],
               ["http://202.213.247.128/nphMotionJpeg/SnapshotJPEG", snapshotOption, u'Japanese Street', 0],
               ["http://211.18.192.147/nphMotionJpeg/SnapshotJPEG", snapshotOption, u'Japanese Studio', 0],
               ["http://www.shokoku-ji.or.jp/kinkakuji/webcam/fullsize.jpg", snapshotOption, u'Kinkakuji', 0],
               ["http://kohama2.miemasu.net:50000/SnapshotJPEG", snapshotOption, u'Kohama', 0],
               ["http://213.28.111.12/record/current.jpg", {}, u'Levi Ski station', 0],
               ["http://www.locogringo.com/Upload/netcam.jpg", {}, u'locogringo', 10],
               ["http://www.rovaniemi.fi/images/webcam/Kamera4_00001.jpg", {}, u'Lordin Aukio - Rovaniemi', 0],
               ["http://lovefm.miemasu.net:60002/SnapshotJPEG", snapshotOption, u'Love FM', 0],
               ["http://mainecam.dyndns.org:50004/SnapshotJPEG", snapshotOption, u'Maine Cam', 0],
               ["http://miyanoura.miemasu.net:60001/SnapshotJPEG", snapshotOption, u'Miya no Ura', 0],
               ["http://iozoonc5.city.miyazaki.miyazaki.jp/snapshotJPEG", snapshotOption, u'Firefoxes from the Miyazaki Zoo', 0],
               ["http://murolucano.dnsalias.com/jpg/image.jpg", {}, u'MuroLucano', 0],
               ["http://www.santaclauslive.com/cam/cam.jpg", {}, u'Napapiiri', 0],
               ["http://napoliwebcam.dnsalias.com/record/current.jpg", {}, u'Napoli', 300],
               ["http://221.251.109.90:84/SnapshotJPEG", snapshotOption, u'Neko Baba', 0],
               ["http://84.53.63.18:8000/axis-cgi/jpg/image.cgi", {}, u'nesna_botrorening', 0],
               ["http://www.wirednewyork.com/webcam2/wirednewyork2.jpg", {}, u'New York Empire State Building', 30],
               ["http://livesite.hongwanji.or.jp/camera/shirasu1.jpg", {}, u'Nishi HonganJi', 10],
               ["http://noshiro-ekimae.miemasu.net:92/snapshotJpeg", snapshotOption, u'Noshiro Ekimae', 0],
               ["http://ocean1cam-2.viewnetcam.com:81/SnapshotJPEG", snapshotOption, u'Ocean View', 0],
               ["http://opccam2.ohsu.edu/axis-cgi/jpg/image.cgi", {}, u'OPC Bridge', 0],
               ["http://www.slednh.com/webcam/netcam.jpg", {}, u'Ossipee Lake', 4],
               ["http://webkamera.overtornea.se/axis-cgi/jpg/image.cgi", {}, u'Overtornea', 0],
               ["http://webcam.ville.woob2.com/Pantheon_full.jpg", {}, u'Panthéon', 0],
               ["http://24.227.114.58/axis-cgi/jpg/image.cgi", {}, u'Perrys Ocean Edge', 0],
               ["http://69.57.245.115/axis-cgi/jpg/image.cgi", {}, u'Pineapple Beach', 0],
               ["http://dokumenty.prague-city.cz/camera/fullsize.jpg", {}, u'Prague Old Town', 0],
               ["http://civl3104acam1.ecn.purdue.edu/axis-cgi/jpg/image.cgi", {}, u'Purdue Armstrong Hall', 0],
               ["http://webcam.sewanee.edu/axis-cgi/jpg/image.cgi", {}, u'Quadcam Sewanee', 0],
               ["http://217.155.209.14:2220/SnapshotJPEG", snapshotOption, u'Random Street', 0],
               ["http://133.5.31.7/axis-cgi/jpg/image.cgi", {}, u'Room 134', 0],
               ["http://shibuya02.ipcam.jp/SnapshotJPEG", snapshotOption, u'Shibuya', 0],
               ["http://81.140.146.203/axis-cgi/jpg/image.cgi", {}, u'South Mainland', 0],
               ["http://195.243.185.195/axis-cgi/jpg/image.cgi", {}, u'Stuttgart  Airport', 0],
               ["http://82.191.220.214/record/current.jpg", {}, u'Svincolo di Lago Negro', 0],
               ["http://www.bbc.co.uk/cgi-perl/webcams/camcache.pl", {'r': 120, 'h': 'mcs', 'l': 'webcams/london/548955.jpg'}, u'Swiss Cottage', 60],
               ["http://taosplaza.viewnetcam.com:50000/SnapshotJPEG", snapshotOption, u'Taos Plaza', 0],
               ["http://tezupin.ddo.jp/SnapshotJPEG", snapshotOption, u'Tezupin Hamsters', 0],
               ["http://207.251.86.248/cctv26.jpg", {}, u'Times Square CCTV', 0],
               ["http://www.bbc.co.uk/london/webcams/images/trafalgar_square.jpg", {}, u'Trafalgar Square', 0],
               ["http://trump.viewnetcam.com:50000/SnapshotJPEG", snapshotOption, u'Trump', 0],
               ["http://62.73.32.2/record/current.jpg", {}, u'Turun Tori', 0],
               ["http://www.serendipity.vi/images/vs.jpg", {}, u'Villa Serendipity', 10],
               ["http://69.146.254.227/axis-cgi/jpg/image.cgi", {}, u'VolksWagen Garage', 0],
               ["http://sprout.warwick.ac.uk/axis-cgi/jpg/image.cgi", {}, u'Warwick Sprout', 0],
               ["http://208.0.229.84/nphMotionJpeg/SnapshotJPEG", snapshotOption, u'Yacht Cam', 0],
               ["http://www.yosemite.org/vryos/sentinel.jpg", {}, u'Yosemite Park', 0]
               ]

if sys.argv[1] == '--list':
    print "Webcam list :\n"
    i = 1
    for webcam in webcam_list:
        print '%d - %s : %s' % (i, webcam[2], webcam[0])
        i=i+1
    exit()
elif sys.argv[1] :
    try:
        i = int(sys.argv[1]) - 1
        webcam_list = [ webcam_list[i] ]
    except:
        print "Incorrect argument, integer lower than %d, '--list' or nothing expected" % len(webcam_list)
        exit()
    
bgfile = open('/tmp/bg.jpg', 'wb+')

##---------------------------------------------------
## This loop ensures the connection to the chosen webcam is possible.
##---------------------------------------------------

while True:
    chosen_one = random.choice(webcam_list)
    print chosen_one[2]
    try:
        if chosen_one[1]:
            params = urllib.urlencode(chosen_one[1])
            bgfile.write(urllib.urlopen(chosen_one[0], params).read())
        else:
            bgfile.write(urllib.urlopen(chosen_one[0]).read())
        break
    except:
##---------------------------------------------------
## This is in case we have only one webcam to choose from !.
##---------------------------------------------------
        if len(webcam_list) < 2 :
            print "connection problem."
            exit()
        pass

bgfile.close()
os.system('gconftool -t string -s /desktop/gnome/background/picture_filename /tmp/bg.jpg')
## print "background changed"

##---------------------------------------------------
## Main loop
##---------------------------------------------------

while True:
    bgtemp = open('/tmp/bgtmp.jpg', 'wb+')
    if chosen_one[1]:
        params = urllib.urlencode(chosen_one[1])
        bgtemp.write(urllib.urlopen(chosen_one[0], params).read())
    else:
        bgtemp.write(urllib.urlopen(chosen_one[0]).read())
    bgtemp.close()
    os.system('cp /tmp/bgtmp.jpg /tmp/bg.jpg')
    if chosen_one[3]:
        time.sleep(chosen_one[3])

J'ai aussi modifié les scripts randomize et celui avec xplanet (étoiles et nuages en temps quasi-réel), si ça intéresse quelqu'un ...

Hors ligne

#10 Le 25/01/2010, à 16:16

nordinatueur

Re : [scripts] - 4 petits scripts fait maison !

Coucou !
Je sais que ça fait un peu déterrage mais j'ai pensé à basculer entre deux images, plutôt que de faire un tampon...
J'ai donc modifié la fin du fichier de cette façon :

 14 # body
 15 papierpeint ()
 16 {
 17 IMAGE=$1
 18 nice wget http://shibuya02.ipcam.jp/SnapshotJPEG --post-data 'Resolution=160x120&Quality=High' -O $IMAGE > /dev/null
 19 gconftool-2 -t string -s /desktop/gnome/background/picture_filename $IMAGE;
 20 sleep 0.3;
 21 }
 22 switch=1
 23 while [ 1 ]; do
 24 
 25 IMAGE1=/tmp/bg1.jpg;
 26 IMAGE2=/tmp/bg2.jpg;
 27 if [ $switch = "1" ]; then
 28 # On met l'image 1 et on supprime la 2, puis on indique qu'on prendra la 2
 29    papierpeint $IMAGE1
 30    rm -f $IMAGE2;
 31    switch=2
 32 else
 33 # On met l'image 2 et on supprime la 1, puis on indique qu'on prendra la 1
 34    papierpeint $IMAGE2
 35    rm -f $IMAGE1;
 36    switch=1
 37 fi
 38 done;
 39 rm /tmp/bg1.jpg /tmp/bg2.jpg

On pourrait même voir à mettre les deux images en argument et ne lancer que la fonction dans l'if.
En plus le sleep se fait juste avant la suppression, donc l'image reste plus longtemps en cache et ça limite les clignotements... Sinon c'est une super idée je trouve ! :-) (avec bien du retard pour moi.)

Par contre, j'ai juste un problème : Parfois le script s'arrête ... wget se gèle et plus rien n'avance (ce qui est logique) Tout ce qu'on peut faire c'est l'arrêter et le relancer.

Dernière modification par nordinatueur (Le 25/01/2010, à 16:18)


Linux User #508094
Pour une meilleure coopération, utilisez des liens relatifs sur le forum !

Hors ligne

#11 Le 25/01/2010, à 22:42

Compte anonymisé

Re : [scripts] - 4 petits scripts fait maison !

nordinatueur peux-tu redonner le script en entier?

Dernière modification par titou345 (Le 25/01/2010, à 22:42)

#12 Le 23/03/2010, à 16:47

nordinatueur

Re : [scripts] - 4 petits scripts fait maison !

Bon avec beaucoup de retard ... (j'étais pas abonné au sujet)

#!/bin/sh

# Static webcam as a wallpaper in gnome v 0.20080418
# Script by MrKikkeli -04.18.08

# we kill first any other static webcam wallpaper process that is currently running,
# otherwhise there will be some mean concurrency
# Make sure all your scripts' names end with webcamwallpaper.sh

for process_to_kill in `ps -ef | grep webcamwallpaper.sh | grep -v $$ | grep -v grep | awk '{print $2}'`; do
kill -1 ${process_to_kill} >> /dev/null;
done


# body
papierpeint ()
{
IMAGE=$1
nice wget http://shibuya02.ipcam.jp/SnapshotJPEG --post-data 'Resolution=160x120&Quality=High' -O $IMAGE > /dev/null
gconftool-2 -t string -s /desktop/gnome/background/picture_filename $IMAGE &
sleep 0.1;
}
switch=1;
compteur=1;
fin=0
while [[ $compteur -le $fin ]]; do
compteur=$(( $compteur + 1 ));

IMAGE1=/tmp/bg1.jpg;
IMAGE2=/tmp/bg2.jpg;
if [ $switch = "1" ]; then
# On met l'image 1 et on supprime la 2, puis on indique qu'on prendra la 2
   papierpeint $IMAGE1
   rm -f $IMAGE2;
   switch=2
else
# On met l'image 2 et on supprime la 1, puis on indique qu'on prendra la 1
   papierpeint $IMAGE2
   rm -f $IMAGE1;
   switch=1
fi
done;
rm /tmp/bg1.jpg /tmp/bg2.jpg

Bon j'ai du le recoller parce que je l'avais perdu... Je l'ai re-testé et il fonctionne.

J'ai aussi ajouté un compteur d'images pour t'éviter des désagréments...
Par défaut, je te conseille de le lancer dans un terminal qui RESTERA OUVERT !
Car dans le cas contraire, tu ne pourra plus changer ton fond d'écran normalement et tu risques de souffrir de latences de ton ordinateur. Ou alors tu peux aussi changer la variable '$fin'.

Bref j'espère t'avoir aidé !


Linux User #508094
Pour une meilleure coopération, utilisez des liens relatifs sur le forum !

Hors ligne