Created attachment 8184 patch Currently panel refresh its state every 30 seconds so once you will plug or unplug power supply from the laptop you have long a delay before battery plugin will show its real state. Patch adds support for Upower events like lid open/lid close, power supply connected and power supply disconnected
Alexander Butenko referenced this bugreport in commit 205a18e99c554529b282b3f30e1cd8e40a5efa55 Listen for UPower events for power source changes (Bug #14978) https://git.xfce.org/panel-plugins/xfce4-battery-plugin/commit?id=205a18e99c554529b282b3f30e1cd8e40a5efa55
Works very well, a nice addition, I just simplified a bit your patch. Thanks!