OSX/Swift: Call function when screen becomes available
问题 I want my OSX app to call a function when the user's screen becomes available, ex: their computer wakes from sleep or the user turns on their screen. Basically any time the user goes from having no screen active to having one active, I would like my function to be called. I'm not sure if the best way to do this is to: Check for changes in sleep/wake state or Use CGDisplayReconfigurationCallback or Listen for a NSWorkspaceScreensDidWakeNotification Which of these seems like the best way to do