reading /proc/acpi/battery on newer linux versions does not work with current code so even when unplugged the battery plugin reports it's on AC power. see this link for the fix in ubuntu, and the actual patch below http://utnubu.alioth.debian.org/scottish/by_maint/pkg-xfce-devel@lists.alioth.debian.org/large/xfce4-battery-plugin/xfce4-battery-plugin_0.3.0-1ubuntu1_packaging.patch -- /home/jani/hack/ubuntu/xfce/packages/orig/battery/orig/xfce4-battery-plugin-0.3.0/panel-plugin/libacpi.c 2003-09-0+++ libacpi.c 2005-10-07 18:05:53.000000000 +0300 @@ -272,12 +272,29 @@ FILE *acpi; char *ptr; char stat; + DIR *acdir; + struct dirent *ac; + char *name; + char acstatus[128]; + + acdir = opendir("/proc/acpi/ac_adapter"); + if (!acdir) + return -1; +/* Works with ACPI versions newer than feb 2002, but this is for 2.6 kernels only anyway */ + while(ac = readdir(acdir)) { + + name = ac->d_name; + + /* skip . and .. */ + if (name[0] == '.') + continue; + sprintf (acstatus, "/proc/acpi/ac_adapter/%s/state", name); + if (!(acpi = fopen (acstatus, "r"))) + return -1; + break; + } if (!(acpi = fopen ("/proc/acpi/ac_adapter/0/status", "r"))) if (!(acpi = fopen ("/proc/acpi/ac_adapter/ACAD/state", "r"))) if (!(acpi = fopen ("/proc/acpi/ac_adapter/AC/state", "r"))) Reproducible: Always Steps to Reproduce: 1. 2. 3.
Applied some lines of it in the new 0.4.90.2 release. Thanks for patch.