Power cord plug/unplug

Hi, ALL,

Is there a way to catch a power cord plug/unplug or a docking station attachment notification?

Or those are not exposed to the programmers?


Thank you.

Replies

I found a poweroff NSEvent, but no indication of what it gives.

Type Property

powerOff

No overview available.

macOS 10.12+

Framework


Declaration

See Also

Declaration

static var powerOff: NSEvent.EventSubtype { get }


https://developer.apple.com/documentation/appkit/nsevent/eventsubtype/1642495-poweroff