diff options
-rw-r--r-- | brightd.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -183,16 +183,16 @@ void setBrightness(int level) { /*{{{*/ */ int isOnAC() /*{{{*/ { - char line[255]; - FILE *ac = fopen("/proc/acpi/ac_adapter/AC/state", "r"); + int ac_state; + FILE *ac = fopen("/sys/class/power_supply/AC/online", "r"); if(!ac) { /* Ignore this */ return 0; } - fgets(line, 255, ac); + ac_state = fgetc(ac); fclose(ac); - return strstr(line, "on-line") != NULL; + return ac_state != '0'; } /*}}}*/ /* |