--- wallpapoz-0.4.1-svn92_trunk/share/wallpapoz/lib/wallpapoz_system.py.kill_multi 2010-03-18 01:01:50.000000000 +0900 +++ wallpapoz-0.4.1-svn92_trunk/share/wallpapoz/lib/wallpapoz_system.py 2010-03-18 01:03:38.000000000 +0900 @@ -189,3 +189,17 @@ print "os.execvp failed, exiting..." sys.exit(1) + def prevent_multiple_start(self): + cpid = os.getpid() + cid = os.getuid() + + wallpapoz_cmd = "pgrep -U %i -f daemon_wallpapoz" %cid + python_cmd = "pgrep -U %i -f python" %cid + + wallpapoz_id_list = os.popen(wallpapoz_cmd).read().splitlines() + python_id_list = os.popen(python_cmd).read().splitlines() + + for id_list in wallpapoz_id_list: + if ( id_list in python_id_list ) and ( int(id_list) != cpid) : + os.kill(int(id_list), signal.SIGTERM) + --- wallpapoz-0.4.1-svn92_trunk/src/daemon_wallpapoz.kill_multi 2010-03-18 01:01:50.000000000 +0900 +++ wallpapoz-0.4.1-svn92_trunk/src/daemon_wallpapoz 2010-03-18 01:01:50.000000000 +0900 @@ -98,6 +98,10 @@ # create the system class ( to change wallpaper and read current desktop ) # by calling external program wallpapoz_system = WallpapozSystem() + + # Kill other daemon_wallpapoz if running + wallpapoz_system.prevent_multiple_start() + available_style = { '3' : 'zoom', '2' : 'scaled', '1' : 'stretched', '0' : 'centered', '4' : 'wallpaper' } style = available_style[wallpapozxml.style()]