Guest User

Sleep Display on Mac

a guest
Feb 21st, 2013
815
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <CoreFoundation/CoreFoundation.h>
  2. #include <IOKit/IOKitLib.h>
  3.  
  4. int main(void)
  5. {
  6.     io_registry_entry_t r = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/IODisplayWrangler");
  7.     if(!r) return 1;
  8.     int err = IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"), kCFBooleanTrue);
  9.     IOObjectRelease(r);
  10.     return err;
  11. }
RAW Paste Data