Bonjour à tous, je vois qu'une solution a déjà été postée. Marche t'elle pour tout le monde?
J'avais contacté par mail Akbar, le développeur de ce petit programme, je pense avoir une solution qui marche. Qui sait, peut-être même la solution qui marchera chez tout le monde. Elle est en tout cas différente de celle signalée ci dessus.
Voici comment procéder :
1. télécharger les sources de Wallpapoz là
http://wallpapoz.sourceforge.net/
2. extraire le tout
3. créer un dossier "bin" malencontreusement oublié dans l'archive. Cela permettra à la commande make de fonctionner
4. ouvrir un terminal et cd /votre/dossier (ou clic droit sur le dossier ouvrir un terminal si vous avez installé le paquet nautilus-open-terminal bien pratique)
5.
make
6.
sudo sh install.sh /usr/local (si vous voulez installer dans /usr/local)
Vous avez maintenant dans menu-application-accessoire un objet Wallpapoz. Il lance le script de configuration. Celui-ci va créer un fichier caché avec vos réglages. Le truc important est le démon qui va changer vos bureaux. Et c'est là que chez certains çà marche, et parfois pas.
Ne cliquez pas sur "start daemon" dans l'écran GUI, vous ne saurez pas si ca marche. Allez dans votre terminal et tapez
daemon_wallpapoz. Si après vous n'avez plus la possibilité d'entrer de commande, c'est que le démon fonctionne. Si par contre vous recevez un message "segmentation fault / erreur de segmentation", il ne fonctionne pas. Etrangement il semble que chez certains il fonctionne, et parfois pas. Akbar n'a pas réussi à corriger cette erreur du démon dans le code source, et il semble qu'elle soit unique à Ubutnu. Mais il a réussi à éviter le problème en recodant le démon en python et non en c++
Vous avez donc besoin du démon en python. Pour le moment il n'est pas sur le site. Akbar portera l'ensemble démon et GUI sur Python plus tard. Pour le moment voici le code du démon en python
## daemon_wallpapoz.py
#
# This file will check desktop continously and change wallpaper
# with preferences from configuration file
from xml.dom import minidom
import xml
import os
import sys
import array
import time
import threading
import random
## number -- global variable
#
# this is index of wallpaper list of workspaces
# for example: number[0] is index of wallpaper list in first workspace
number = array.array('i')
## delay -- global variable, how many time will wallpaper list thread
#
# has to wait before it manipulate its index
delay = 1.0
## random -- global variable, is wallpaper list thread randomize its index
randomvar = 0
exit_code = 0
## XMLProcessing -- class for processing wallpapoz xml file
class XMLProcessing:
## The constructor
def __init__(self, file):
try:
self.xmldoc = minidom.parse(file)
except IOError:
print "There is no configuration file. Create it first by running wallpapoz!"
sys.exit()
except xml.parsers.expat.ExpatError:
print "The configuration file is corrupted. Remove it then create it again with wallpapoz!"
sys.exit()
self.wallpapoz_node = self.xmldoc.childNodes[1]
self.workspace_node_list = self.wallpapoz_node.getElementsByTagName('workspace')
self.workspace_num = self.workspace_node_list.length
## class method -- get delay time that wallpaper list thread manipulate its index
def delay(self):
return self.wallpapoz_node.attributes["interval"].value
## class method -- whether the wallpaper list thread randomize its index
def is_random(self):
return self.wallpapoz_node.attributes["random"].value
## class method -- method for fill list with wallpaper path file
def fill_list(self):
worklist = []
for i in range(self.workspace_num):
worklist.append( [] )
index = -1
for file in self.workspace_node_list:
file_node_list = file.getElementsByTagName('file')
index = index + 1
for node in file_node_list:
if node.nodeName == "file":
worklist[index].append(node.firstChild.data)
return worklist
## class method -- to know how many workspace we use
def get_workspace_num(self):
return self.workspace_num
## System -- class for knowing current desktop and change wallpaper
#
# with calling external program
class System:
## class method to know what workspace we are in now
def current_desktop(self):
desktop = os.popen('xprop -root _NET_CURRENT_DESKTOP').read()
return int(desktop[33] + desktop[34])
## class method
def change_wallpaper(self, wallpaper):
os.system('gconftool-2 -t string -s /desktop/gnome/background/picture_filename ' + "\"" + wallpaper + "\"")
## AsyncIndex -- class for making thread that manipulating index wallpaper list
class AsyncIndex(threading.Thread):
## constructor
def __init__(self, index):
threading.Thread.__init__(self)
self.index = index
## the function that thread will execute
def run(self):
if randomvar == 1:
number[self.index] = 0
size = len(worklist[self.index])
while True:
number[self.index] = int(random.random() * size)
time.sleep(delay)
else:
while True:
number[self.index] = 0
for i in worklist[self.index]:
time.sleep(delay)
number[self.index] = number[self.index] + 1
## the main program
if __name__ == "__main__":
# generate seed for random number
random.seed()
# the configuration file
file = os.environ['HOME'] + "/.wallpapoz/wallpapoz.xml"
# call the xmlprocessing class to read it
wallpapozxml = XMLProcessing(file)
# fill the workspace list
worklist = wallpapozxml.fill_list()
# how many workspace we use
total_workspace = wallpapozxml.get_workspace_num()
# create the index for wallpaper list thread
number.fromlist( range( total_workspace ) )
# create the system class ( to change wallpaper and read current desktop )
# by calling external program
system = System()
# previous workspace
previous_desktop = -1
# previous wallpaper list index
previous_index = -1
# get the delay time and random preferences
delay = 60 * float(wallpapozxml.delay())
randomvar = int(wallpapozxml.is_random())
# create the thread
wallpaper_list = []
for i in range(total_workspace):
wallpaper_list.append(AsyncIndex(i))
wallpaper_list[i].start()
# the daemon that works forever
while True:
try:
# don't get rush
time.sleep(1)
# what workspace we are in now?
cur_desk = system.current_desktop()
# requirement for changing wallpaper
# 1. we change workspace
# 2. index of wallpaper list change
if previous_desktop != cur_desk or previous_index != number[cur_desk]:
# if we move to workspace that we don't use, just ignore
if cur_desk >= total_workspace:
continue
# command to change wallpaper
system.change_wallpaper(worklist[cur_desk][number[cur_desk]])
# our previous workspace and index of wallpaper list
previous_desktop = cur_desk
previous_index = number[cur_desk]
# ok, we stop this daemon
except KeyboardInterrupt:
# now it's time for the main thread to exit
os._exit(0)
7. copier le code python dans un fichier texte. Le nommer daemon_wallpapoz.py
8.
sudo cp daemon_wallpapoz.py /usr/local/daemon_wallpapoz.py
lancez le avec la commande
python daemon_wallpapoz.py
tout devrait marcher. Vérifiez que vous avez des fonds d'écran différent sur vos différents bureaux. Le démon aura besoin de quelques secondes pour changer correctement vos bureaux. Si tout marche, ajoutez une entrée à votre session pour le lancer à l'ouverture de session.