Programmatically getting battery status

Ken Brown kbrown@cornell.edu
Wed Jan 10 20:18:00 GMT 2018


On most platforms Emacs is able to display battery status on its mode 
line.  I'd like to try to implement this on Cygwin, but I could use some 
pointers on how to get started and what method would be preferred.

Emacs uses /proc/apm, /proc/acpi/battery, or /sys/class/power_supply/ on 
Linux; /usr/sbin/apm on BSD; pmset on macOS; and GetSystemPowerStatus on 
Windows.

What would be the preferred approach on Cygwin?  Based on absolutely no 
knowledge, my instinct would be to use GetSystemPowerStatus to populate 
a suitable file in /proc and/or to write a utility (usr/sbin/apm.exe). 
But I have no specific ideas beyond that.

Ken



More information about the Cygwin-developers mailing list