Please take a look at the sample
ConfigFvwmAPMDaemon for how it works.
