Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions i3status.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ int main(int argc, char *argv[]) {
CFG_BOOL("last_full_capacity", false, CFGF_NONE),
CFG_BOOL("integer_battery_capacity", false, CFGF_NONE),
CFG_BOOL("hide_seconds", true, CFGF_NONE),
CFG_BOOL("full_good", false, CFGF_NONE),
CFG_CUSTOM_ALIGN_OPT,
CFG_CUSTOM_COLOR_OPTS,
CFG_CUSTOM_MIN_WIDTH_OPT,
Expand Down Expand Up @@ -747,6 +748,7 @@ int main(int argc, char *argv[]) {
.last_full_capacity = cfg_getbool(sec, "last_full_capacity"),
.format_percentage = cfg_getstr(sec, "format_percentage"),
.hide_seconds = cfg_getbool(sec, "hide_seconds"),
.full_good = cfg_getbool(sec, "full_good"),
};
print_battery_info(&ctx);
SEC_CLOSE_MAP;
Expand Down
1 change: 1 addition & 0 deletions include/i3status.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ typedef struct {
bool last_full_capacity;
const char *format_percentage;
bool hide_seconds;
bool full_good;
} battery_info_ctx_t;

void print_battery_info(battery_info_ctx_t *ctx);
Expand Down
4 changes: 4 additions & 0 deletions src/print_battery_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,10 @@ void print_battery_info(battery_info_ctx_t *ctx) {
batt_info.seconds_remaining = 0;
}

if (batt_info.status == CS_FULL && ctx->full_good ){
START_COLOR("color_good");
colorful_output = true;
}
if (batt_info.status == CS_DISCHARGING && ctx->low_threshold > 0) {
if (batt_info.percentage_remaining >= 0 && strcasecmp(ctx->threshold_type, "percentage") == 0 && batt_info.percentage_remaining < ctx->low_threshold) {
START_COLOR("color_bad");
Expand Down