Skip to content

Repository files navigation

PowerMonitor

I was on a flight that only had a USB power outlet, and I didn't know whether I was drawing more power than I was receiving. So I built this.

PowerMonitor menu bar

A single-file SwiftUI menu bar app for macOS. Event-driven via IOKit — near-zero CPU when idle.

Install

git clone https://github.com/jlreyes/PowerMonitor.git
cd PowerMonitor
make install
open -a ~/.local/bin/PowerMonitor.app

Auto-start on login

make launchd-install

To remove:

make launchd-uninstall

How it works

  • Registers an IOPSNotificationCreateRunLoopSource callback that fires on any power source change
  • Reads AppleSmartBattery via IOKit for voltage, amperage, charging state
  • If ExternalConnected == true && InstantAmperage < 0 — you're draining while plugged in
  • Sends a native macOS notification (5-min cooldown) when this happens

Menu bar states

Icon Meaning
⚡ 9W Plugged in, charging at 9W into battery
⚠ 5W Plugged in, draining at 5W (charger can't keep up)
63% On battery

Requirements

  • macOS 13+
  • Swift 5.9+

License

MIT

About

macOS menu bar app that monitors power draw vs charger input. Warns when your system draws more than your charger can supply.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages