Ok, here is the updated version. I rewrote it in the way to work out-of-box for most (with single battery) users. Checked it works fine with no D-Bus compiled in. Or with disabled "upowerd" Few users on different laptops tried this code and it works out-of-box for them. I did not documented power_supply interface, English is not my native language, somebody could do it much better. Also I have no knowledge at all about power_supply interface. Thanks -- lg