Icon Changes & AC Power

- Remove dividers from inside battery_all_in_one function
- When there is no battery, show plug with AC
- Change charging status symbol to plug
- Move charging status in front of battery icon
- Change divider back to "|"
This commit is contained in:
Sravan Balaji
2020-08-07 22:57:51 -04:00
parent 764813c0c1
commit 59be5d4cd5
2 changed files with 7 additions and 6 deletions

View File

@@ -123,11 +123,10 @@
battery_all_in_one(const char *bat)
{
char path[PATH_MAX];
char *div = "";
if (esnprintf(path, sizeof(path),
"/sys/class/power_supply/%s", bat) < 0) {
return bprintf(" %s ", div);
return " AC";
}
DIR* dir = opendir(path);
@@ -138,7 +137,7 @@
}
else if (ENOENT == errno) {
// Battery doesn't exist
return bprintf(" %s ", div);
return " AC";
}
int percentage = atoi(battery_perc(bat));
@@ -179,7 +178,7 @@
}
if (!strcmp(battery_state(bat), "+")) {
bat_status = "";
bat_status = "";
bat_rem = "";
}
else {
@@ -190,7 +189,7 @@
sprintf(bat_rem, " (%s)", temp);
}
return bprintf(" %s %s%s %i%%%s %s ", div, bat_icon, bat_status, percentage, bat_rem, div);
return bprintf(" %s%s %i%%%s ", bat_status, bat_icon, percentage, bat_rem);
}
#elif defined(__OpenBSD__)
#include <fcntl.h>