hammerspoon2-docs
    Preparing search index...

    Function addBatteryWatcher

    • Registers a listener that fires whenever battery state changes. The listener receives no arguments; call batteryInfo() or read individual properties inside the callback to determine what changed. The OS notification subscription starts lazily on the first listener and is released automatically when the last listener is removed.

      Parameters

      • listener: () => void

        A function called with no arguments on battery state change.

      Returns void