This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Programmatically getting battery status


On 1/10/2018 3:17 PM, Ken Brown wrote:
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.

On second thought, unless people would find this useful for other purposes, I may be losing motivation to work on this. It turns out that the Emacs function for getting battery status in the Windows build is already built into the Cygwin emacs-w32 build. It shouldn't be hard to make Cygwin's emacs-nox and emacs-X11 use this function also.

Ken


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]