Skip to content

Mac OS - fullscreen doesn't wake screens

on Windows/Linux, triggering fullscreen wakes the screens. This is really nice when using the http interface.

this doesn't currently happen on mac os.

I have done a bit of digging, and this seems to be the best code to wake the screens, though it requires 10.6

There are other hacks around sending fake key/mouse events, or possibly using applscript, but they don't seem reliable

#import <IOKit/pwr_mgt/IOPMLib.h>

-(void)wakeScreens
{
    //requires Mac OS X v10.6.
  
    CFStringRef reasonForActivity= CFSTR("VLC screen wake");
    
    IOPMAssertionID assertionID;
    IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, 
                                                   kIOPMAssertionLevelOn, reasonForActivity, &assertionID); 
    if (success == kIOReturnSuccess)
    {
        //release immediately, hand screen state back to normal methods
        success = IOPMAssertionRelease(assertionID);
    }
}
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information