Now before everyone starts fighting if apple actually lets developers touch the system in a way, they do provide the messages to send to the PMRootDomain to disable clamshell sleep, but it is only intended for system drivers, so you are correct that apple doesnt want them used but they are provided freely to be used.
/*******************************************************************************
*
* Power commands issued to root domain
*
* These commands are issued from system drivers only:
* ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily
*
******************************************************************************/
enum {
kIOPMSleepNow = (1<<0), // put machine to sleep now
kIOPMAllowSleep = (1<<1), // allow idle sleep
kIOPMPreventSleep = (1<<2), // do not allow idle sleep
kIOPMPowerButton = (1<<3), // power button was pressed
kIOPMClamshellClosed = (1<<4), // clamshell was closed
kIOPMPowerEmergency = (1<<5), // battery dangerously low
kIOPMDisableClamshell = (1<<6), // do not sleep on clamshell closure
kIOPMEnableClamshell = (1<<7), // sleep on clamshell closure
kIOPMProcessorSpeedChange = (1<<8), // change the processor speed
kIOPMOverTemp = (1<<9), // system dangerously hot
kIOPMClamshellOpened = (1<<10) // clamshell was opened
};
But seriously can we get back to the point!!!!
How does one get a notification of the lid state changing (When the lid closes, nothing to do with sleep) that does not also mix up with the power state changing, you will notice i dont mention a single thing about forcing the system to stay awake or anything here, so please can we drop the debate and stop flooding the mailing list with the debate that will never end and just get to the point. which just as safe measure ill say once again... How does one get a notification of the lid state changing (When the lid closes, nothing to do with sleep) that does not also mix up with the power state changing