summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--brightd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/brightd.c b/brightd.c
index 244dd60..e9958a6 100644
--- a/brightd.c
+++ b/brightd.c
@@ -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;
} /*}}}*/
/*