Comment 13 for bug 213128

Revision history for this message
Louimama (louismjacquelin) wrote : Re: [Hardy] Guidance-power-manager doesn't know when laptop is mains unplugged

Ok. I did a quick and dirty hack. Now that works on my machine. Of course this issue should be resolved in hal, but at least it works. Edit /usr/share/python-support/kde-guidance-powermanager/powermanage.py and change the function onBattery to look that way

def onBattery(self):
        """ Find out if we're on AC or on battery using HAL. """
        if not self.hasAC:
            print "No AC adapter found - assume that we are on batteries."
            return False

 properties = self.batteries[0].GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
 return properties["battery.rechargeable.is_discharging"]

Luka, maybe it is possible to combine the two tests, both on the ac_adapter and the battery state ?