diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/output.c | 7 | ||||
-rw-r--r-- | src/print_battery_info.c | 18 | ||||
-rw-r--r-- | src/print_cpu_usage.c | 2 | ||||
-rw-r--r-- | src/print_disk_info.c | 8 | ||||
-rw-r--r-- | src/print_volume.c | 4 | ||||
-rw-r--r-- | src/print_wireless_info.c | 6 |
6 files changed, 25 insertions, 20 deletions
diff --git a/src/output.c b/src/output.c index b2fb1dd..f7a8888 100644 --- a/src/output.c +++ b/src/output.c @@ -11,7 +11,8 @@ #include "i3status.h" /* - * Returns the correct color format for dzen (^fg(color)) or xmobar (<fc=color>) + * Returns the correct color format for dzen (^fg(color)), xmobar (<fc=color>) + * or lemonbar (%{Fcolor}) * */ char *color(const char *colorstr) { @@ -24,6 +25,8 @@ char *color(const char *colorstr) { (void)snprintf(colorbuf, sizeof(colorbuf), "^fg(%s)", cfg_getstr(cfg_general, colorstr)); else if (output_format == O_XMOBAR) (void)snprintf(colorbuf, sizeof(colorbuf), "<fc=%s>", cfg_getstr(cfg_general, colorstr)); + else if (output_format == O_LEMONBAR) + (void)snprintf(colorbuf, sizeof(colorbuf), "%%{F%s}", cfg_getstr(cfg_general, colorstr)); else if (output_format == O_TERM) { /* The escape-sequence for color is <CSI><col>;1m (bright/bold * output), where col is a 3-bit rgb-value with b in the @@ -61,6 +64,8 @@ void print_separator(const char *separator) { printf("^fg(%s)%s^fg()", cfg_getstr(cfg_general, "color_separator"), separator); else if (output_format == O_XMOBAR) printf("<fc=%s>%s</fc>", cfg_getstr(cfg_general, "color_separator"), separator); + else if (output_format == O_LEMONBAR) + printf("%%{F%s}%s%%{F-}", cfg_getstr(cfg_general, "color_separator"), separator); else if (output_format == O_TERM) printf("%s%s%s", color("color_separator"), separator, endcolor()); else if (output_format == O_NONE) diff --git a/src/print_battery_info.c b/src/print_battery_info.c index 0853e18..f65090a 100644 --- a/src/print_battery_info.c +++ b/src/print_battery_info.c @@ -146,9 +146,9 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char percentage_remaining = 100; } if (integer_battery_capacity) { - (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00f%%", percentage_remaining); + (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00f%s", percentage_remaining, pct_mark); } else { - (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.02f%%", percentage_remaining); + (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.02f%s", percentage_remaining, pct_mark); } if (present_rate > 0) { @@ -245,8 +245,8 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char (void)snprintf(statusbuf, sizeof(statusbuf), "%s", BATT_STATUS_NAME(status)); - (void)snprintf(percentagebuf, sizeof(percentagebuf), "%02d%%", - present_rate); + (void)snprintf(percentagebuf, sizeof(percentagebuf), "%02d%s", + present_rate, pct_mark); if (state == 1) { int hours, minutes; @@ -304,7 +304,7 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char (void)snprintf(statusbuf, sizeof(statusbuf), "%s", BATT_STATUS_NAME(status)); /* integer_battery_capacity is implied as battery_life is already in whole numbers. */ - (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00d%%", apm_info.battery_life); + (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00d%s", apm_info.battery_life, pct_mark); if (status == CS_DISCHARGING && low_threshold > 0) { if (strcasecmp(threshold_type, "percentage") == 0 && apm_info.battery_life < low_threshold) { @@ -494,13 +494,13 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char if (integer_battery_capacity) (void)snprintf(percentagebuf, sizeof(percentagebuf), - "%d%%", - (int)percentage_remaining); + "%d%s", + (int)percentage_remaining, pct_mark); else (void)snprintf(percentagebuf, sizeof(percentagebuf), - "%.02f%%", - percentage_remaining); + "%.02f%s", + percentage_remaining, pct_mark); /* * Handle percentage low_threshold here, and time low_threshold when diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c index 927e763..adf2d04 100644 --- a/src/print_cpu_usage.c +++ b/src/print_cpu_usage.c @@ -102,7 +102,7 @@ void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format) { } if (BEGINS_WITH(walk + 1, "usage")) { - outwalk += sprintf(outwalk, "%02d%%", diff_usage); + outwalk += sprintf(outwalk, "%02d%s", diff_usage, pct_mark); walk += strlen("usage"); } } diff --git a/src/print_disk_info.c b/src/print_disk_info.c index e5e3ab1..12d7585 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -179,22 +179,22 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch } if (BEGINS_WITH(walk + 1, "percentage_free")) { - outwalk += sprintf(outwalk, "%.01f%%", 100.0 * (double)buf.f_bfree / (double)buf.f_blocks); + outwalk += sprintf(outwalk, "%.01f%s", 100.0 * (double)buf.f_bfree / (double)buf.f_blocks, pct_mark); walk += strlen("percentage_free"); } if (BEGINS_WITH(walk + 1, "percentage_used_of_avail")) { - outwalk += sprintf(outwalk, "%.01f%%", 100.0 * (double)(buf.f_blocks - buf.f_bavail) / (double)buf.f_blocks); + outwalk += sprintf(outwalk, "%.01f%s", 100.0 * (double)(buf.f_blocks - buf.f_bavail) / (double)buf.f_blocks, pct_mark); walk += strlen("percentage_used_of_avail"); } if (BEGINS_WITH(walk + 1, "percentage_used")) { - outwalk += sprintf(outwalk, "%.01f%%", 100.0 * (double)(buf.f_blocks - buf.f_bfree) / (double)buf.f_blocks); + outwalk += sprintf(outwalk, "%.01f%s", 100.0 * (double)(buf.f_blocks - buf.f_bfree) / (double)buf.f_blocks, pct_mark); walk += strlen("percentage_used"); } if (BEGINS_WITH(walk + 1, "percentage_avail")) { - outwalk += sprintf(outwalk, "%.01f%%", 100.0 * (double)buf.f_bavail / (double)buf.f_blocks); + outwalk += sprintf(outwalk, "%.01f%s", 100.0 * (double)buf.f_bavail / (double)buf.f_blocks, pct_mark); walk += strlen("percentage_avail"); } } diff --git a/src/print_volume.c b/src/print_volume.c index 86b3505..58cba2a 100644 --- a/src/print_volume.c +++ b/src/print_volume.c @@ -37,11 +37,11 @@ static char *apply_volume_format(const char *fmt, char *outwalk, int ivolume) { continue; } if (BEGINS_WITH(walk + 1, "%")) { - outwalk += sprintf(outwalk, "%%"); + outwalk += sprintf(outwalk, "%s", pct_mark); walk += strlen("%"); } if (BEGINS_WITH(walk + 1, "volume")) { - outwalk += sprintf(outwalk, "%d%%", ivolume); + outwalk += sprintf(outwalk, "%d%s", ivolume, pct_mark); walk += strlen("volume"); } } diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c index 48d81d4..4639625 100644 --- a/src/print_wireless_info.c +++ b/src/print_wireless_info.c @@ -480,7 +480,7 @@ void print_wireless_info(yajl_gen json_gen, char *buffer, const char *interface, if (BEGINS_WITH(walk + 1, "quality")) { if (info.flags & WIRELESS_INFO_FLAG_HAS_QUALITY) { if (info.quality_max) - outwalk += sprintf(outwalk, "%03d%%", PERCENT_VALUE(info.quality, info.quality_max)); + outwalk += sprintf(outwalk, "%03d%s", PERCENT_VALUE(info.quality, info.quality_max), pct_mark); else outwalk += sprintf(outwalk, "%d", info.quality); } else { @@ -492,7 +492,7 @@ void print_wireless_info(yajl_gen json_gen, char *buffer, const char *interface, if (BEGINS_WITH(walk + 1, "signal")) { if (info.flags & WIRELESS_INFO_FLAG_HAS_SIGNAL) { if (info.signal_level_max) - outwalk += sprintf(outwalk, "%03d%%", PERCENT_VALUE(info.signal_level, info.signal_level_max)); + outwalk += sprintf(outwalk, "%03d%s", PERCENT_VALUE(info.signal_level, info.signal_level_max), pct_mark); else outwalk += sprintf(outwalk, "%d dBm", info.signal_level); } else { @@ -504,7 +504,7 @@ void print_wireless_info(yajl_gen json_gen, char *buffer, const char *interface, if (BEGINS_WITH(walk + 1, "noise")) { if (info.flags & WIRELESS_INFO_FLAG_HAS_NOISE) { if (info.noise_level_max) - outwalk += sprintf(outwalk, "%03d%%", PERCENT_VALUE(info.noise_level, info.noise_level_max)); + outwalk += sprintf(outwalk, "%03d%s", PERCENT_VALUE(info.noise_level, info.noise_level_max), pct_mark); else outwalk += sprintf(outwalk, "%d dBm", info.noise_level); } else { |