[compiz] Compiz web based settings framework

Mike Dransfield
Wed, 11 Apr 2007 06:57:57 -0000

Here is a new way for people to access compiz settings.  This is 2
pieces of software in one.

1. HTTP -> DBUS -> JSON bridge
2. Web based settings application based on that

The most important part is the first because it allows you to change
compiz settings using HTTP requests made to a locally running http
server.

To install this untar the file below and copy the cws directory to your
~/.compiz directory and copy cws.py to your autostart folder.  Once
cws.py is running it provides a web server on port 8899 (by default)
which runs the default web app.  This app is just something I made
quickly to demonstrate and develop everything.  You should be able to
come up with something much nicer ;)

http://www.anykeysoftware.co.uk/compiz/cws.tar.gz

The web server responds to requests similar to dbus and it responds
with JSON data, this is the easiest to evaluate with web based languages.

The API is like this, look in http.js for examples of its use with
HTTPRequest.

The path you make the request to relates to the dbus object path.  Each
path has different methods.  You tell it which method with a GET request.

/ (root path)

?method=getPluginMetadata&plugin=cube   - get metadata about a plugin
?method=loadPlugin&plugin=cube  - loads a plugin, performs dependency
checking so you can load any plugin without worrying about order
?method=loadPlugin&plugin=cube  - unloads a plugin
?method=getAvailablePlugins  - Lists all available plugins (not loaded ones)
?method=getActivePlugins  - Lists all active plugins

if no method is specified then it will return the index.html file from
~/.commpiz/cws/<theme>/

/cube (plugin path)

Any request to this url will return a list of all options for that plugin
(grouped by screen)

/cube/allscreens (screen path)

Any request to this URL will respond with a list of all options for
that screen

/cube/allscreens/unfold   (option path)

?method=set&value=val - will set an option value

Lists must be sent with the name ending in square brackets
(ie. value[]=val1&value[]=val2)

Actions are the same but the action part name must  be in the brackets
(ie. value[bell]=1&value[key]=<Super>F1)

Any other request to an option path will return the option value.