diff --git a/doc/config_settings.xml b/doc/config_settings.xml index af9ab3f7..c98adccc 100644 --- a/doc/config_settings.xml +++ b/doc/config_settings.xml @@ -1038,6 +1038,15 @@ Zero makes Conky run forever. + + + + + + + String to place between values and units. (default: empty) + + diff --git a/src/conky.cc b/src/conky.cc index 47f510fe..de1bbbf7 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -189,6 +189,8 @@ static conky::simple_config_setting short_units("short_units", false, true); static conky::simple_config_setting format_human_readable( "format_human_readable", true, true); +conky::simple_config_setting units_spacer("units_spacer", "", + false); conky::simple_config_setting out_to_stdout("out_to_console", // Default value is false, unless we are building without X @@ -613,16 +615,17 @@ void human_readable(long long num, char *buf, int size) { return; } if (short_units.get(*state)) { - width = 6; - format = "%.*f %.1s"; + width = 5; + format = "%.*f%s%.1s"; } else { - width = 8; - format = "%.*f %-.3s"; + width = 7; + format = "%.*f%s%-.3s"; } + width += strlen(units_spacer.get(*state).c_str()); if (llabs(num) < 1000LL) { spaced_print(buf, size, format, width, 0, static_cast(num), - _(*suffix)); + units_spacer.get(*state).c_str(), _(*suffix)); return; } @@ -655,7 +658,8 @@ void human_readable(long long num, char *buf, int size) { if (fnum < 99.95) { precision = 1; /* print 10-99 with one decimal place */ } if (fnum < 9.995) { precision = 2; /* print 0-9 with two decimal places */ } - spaced_print(buf, size, format, width, precision, fnum, _(*suffix)); + spaced_print(buf, size, format, width, precision, fnum, + units_spacer.get(*state).c_str(), _(*suffix)); } /* global object list root element */