July 9th, 2007 @ 16:36

My libcompizconfig patch to enable software to create an empty context and load a custom set of plugins afterwars has just been accepted =) The compizconfig-python bindings were updated as well!

Here is an updated “plugin reloader” script :

#!/usr/bin/env python
'''Compiz plugin reloader (through compizconfig)
Copyright (c) 2007 Guillaume Seguin <guillaume@segu.in>
Licensed under GNU GPLv2'''
import compizconfig
from sys import argv, exit
from time import sleep
if __name__ == "__main__":
    if len (argv) < 2:
        print "Usage : %s plugin1 [plugin2 ... pluginN]" % argv[0]
        exit (2)
    plugins = argv[1:]
    context = compizconfig.Context (plugins = plugins)
    print "Unloading " + " ".join (plugins)
    for plugin in plugins:
        if plugin not in context.Plugins:
            print "Warning : %s plugin not found" % plugin
            plugins.remove (plugin)
        context.Plugins[plugin].Enabled = False
    if len (plugins) == 0:
        print "Error : no plugin found"
        exit (1)
    context.Write ()
    print "Waiting before reloading"
    sleep (2)
    print "Loading " + " ".join (plugins)
    for plugin in plugins:
        context.Plugins[plugin].Enabled = True
    context.Write ()