Made battery segment work on MacOSX

The battery segment were not working on my Macbook Pro because there are no ACPI, here is a working version using native apple tools
And so are all changes to this function.