0

How do I get the current power source on a Mac, using IOKit?

I want to see if the Mac is running via the built-in battery or via a power adapter.

lukas
  • 2,300
  • 6
  • 28
  • 41

1 Answers1

2

The functions in IOPowerSources.h (specifically, IOPSGetProvidingPowerSourceType()) will give you the info you're looking for.

jatoben
  • 3,079
  • 15
  • 12