Full Battery Fix
- Add mapping for battery full - Output remaining time if discharging, plug icon otherwise
This commit is contained in:
@@ -55,6 +55,7 @@
|
|||||||
} map[] = {
|
} map[] = {
|
||||||
{ "Charging", "+" },
|
{ "Charging", "+" },
|
||||||
{ "Discharging", "-" },
|
{ "Discharging", "-" },
|
||||||
|
{ "Full", "=" },
|
||||||
};
|
};
|
||||||
size_t i;
|
size_t i;
|
||||||
char path[PATH_MAX], state[12];
|
char path[PATH_MAX], state[12];
|
||||||
@@ -177,17 +178,17 @@
|
|||||||
bat_icon = "";
|
bat_icon = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(battery_state(bat), "+")) {
|
if (!strcmp(battery_state(bat), "-")) {
|
||||||
bat_status = " ";
|
|
||||||
bat_rem = "";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bat_status = "";
|
bat_status = "";
|
||||||
|
|
||||||
const char *temp = battery_remaining(bat);
|
const char *temp = battery_remaining(bat);
|
||||||
bat_rem = (char*) malloc(sizeof(temp) + 2);
|
bat_rem = (char*) malloc(sizeof(temp) + 2);
|
||||||
sprintf(bat_rem, " (%s)", temp);
|
sprintf(bat_rem, " (%s)", temp);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
bat_status = " ";
|
||||||
|
bat_rem = "";
|
||||||
|
}
|
||||||
|
|
||||||
return bprintf(" %s%s %i%%%s ", bat_status, bat_icon, percentage, bat_rem);
|
return bprintf(" %s%s %i%%%s ", bat_status, bat_icon, percentage, bat_rem);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user