Quite often people ask whether Metacity can talk to you across D-BUS, or something similar. It can’t. There is no need for this, because you can do pretty much anything you want using X messages. In particular, you can use messages from the EWMH specification to perform pretty much any task you might want, and there are some additional Metacity-specific ones (such as an instruction to change the theme).
If you want to play with a client which can send these messages, I recommend wmctrl. Try installing it (it’s in most distros, I think), and then playing with it to see how you can
- switch desktops
- bring a window to a desktop
- resize a window
- maximise a window
- minimise all windows
- list all windows
- rename a window
- … and so on.
Read its source for all the details; it’s quite clearly laid out.