0

I need to receive notifications about number of monitors plugged in to the Mac laptop from my launch daemon (written in C++). In particular I'm using CGDisplayRegisterReconfigurationCallback function and some others (see below).

If I implement it in my launch daemon, it works in a kinda strange way. Most times it works OK, but sometimes crashes the daemon with SIGABRT and weird callstacks.

I did some research and it turns out that I can't use certain frameworks from a launch daemon.

The question is then, how can I call that CGDisplayRegisterReconfigurationCallback function, along with CGMainDisplayID, CGGetActiveDisplayList, CGDisplayIsActive, etc that are needed for the functionality of my app? Any suggestions?

c00000fd
  • 20,994
  • 29
  • 177
  • 400

0 Answers0