How can I be notified of changes to the monitors?
For example, if you have a monitor connected to your laptop and you close the laptop to work only with the monitor. Can I be notified of this change?
How can I be notified of changes to the monitors?
For example, if you have a monitor connected to your laptop and you close the laptop to work only with the monitor. Can I be notified of this change?
You can check CGDisplayReconfigurationEventMBS class in MBS Xojo Plugins.
or applicationDidChangeScreenParameters event in NSApplicationDelegateMBS class as Greg suggests.
macOS posts a system notification when this happens. You could listen for that.
Thanks, Christian. I didn’t know that. I’ll add it right away.
It worked perfectly. I can now save window positions, including monitor configuration. When I close the laptop and only have the second monitor on, the windows are positioned according to the positions for the individual monitors. When I open the laptop again, everything is as it was before.