One of the things that are particularly boring when working on a Compiz plugin is that you have to reload it all the time, and there is no quick way to do it (I usually unload/reload it through ccsm, which involves some mouse deplacement and needs a ccsm window, or or I just reload compiz, which takes quite a bit of time).
Consequently I thought I could write a little script that would reload one or more plugins for me quickly. It took less than 5 minutes with the neat libcompizconfig python bindings, and works pretty well as far as I can see. (so yes, it depends on libcompizconfig, but heh, that’s worth it)
Here is the code :
#!/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 (basic_metadata = True) print "Unloading " + " ".join (plugins) for plugin in plugins: if plugin not in context.Plugins: print "Warning : %s plugin not found" % plugin plugins.remove (plugin) continue context.Plugins[plugin].Enabled = False if len (plugins) == 0: print "Error : no plugin found" exit (1) context.Write () print "Waiting for settings update" sleep (2) print "Loading " + " ".join (plugins) for plugin in plugins: context.Plugins[plugin].Enabled = True context.Write ()

