Example randr uses the randr protocol to get information about the active heads. It also listens for events that are sent when the head configuration changes. Since it listens to events, you'll have to manually kill this process when you're done (i.e., ctrl+c.)
While this program is running, if you use 'xrandr' to reconfigure your heads, you should see event information dumped to standard out.
For more information, please see the RandR protocol spec: http://www.x.org/releases/X11R7.6/doc/randrproto/randrproto.txt