Created
February 10, 2018 19:59
-
-
Save dedeibel/a2ddf3fc4d55b02bc7d5586880f4ed0a to your computer and use it in GitHub Desktop.
patch for i3status 2.11 with a slimmer number formatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff i3status-2.11/src/print_cpu_usage.c i3status-2.11_modified/src/print_cpu_usage.c | |
120c120 | |
< outwalk += sprintf(outwalk, "%02d%s", diff_usage, pct_mark); | |
--- | |
> outwalk += sprintf(outwalk, "%2d%s", diff_usage, pct_mark); | |
diff i3status-2.11/src/print_disk_info.c i3status-2.11_modified/src/print_disk_info.c | |
42c42 | |
< return sprintf(outwalk, "%.1f %sB", size, symbols[exponent]); | |
--- | |
> return sprintf(outwalk, "%.f %sB", size, symbols[exponent]); | |
diff i3status-2.11/src/print_wireless_info.c i3status-2.11_modified/src/print_wireless_info.c | |
499,500c499,505 | |
< if (info.quality_max) | |
< outwalk += sprintf(outwalk, "%3d%s", PERCENT_VALUE(info.quality, info.quality_max), pct_mark); | |
--- | |
> if (info.quality_max) { | |
> int wifi_percent = PERCENT_VALUE(info.quality, info.quality_max); | |
> if (wifi_percent == 100) { | |
> wifi_percent = 99; | |
> } | |
> outwalk += sprintf(outwalk, "%2d%s", wifi_percent, pct_mark); | |
> } | |
511,512c516,522 | |
< if (info.signal_level_max) | |
< outwalk += sprintf(outwalk, "%3d%s", PERCENT_VALUE(info.signal_level, info.signal_level_max), pct_mark); | |
--- | |
> if (info.signal_level_max) { | |
> int wifi_percent = PERCENT_VALUE(info.signal_level, info.signal_level_max); | |
> if (wifi_percent == 100) { | |
> wifi_percent = 99; | |
> } | |
> outwalk += sprintf(outwalk, "%2d%s", wifi_percent, pct_mark); | |
> } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment