There already is 100% working daemon for recognizing proximity sensor state (not using much resources, in fact, almost none at all)...
... multitouch ...