Closed YodaEmbedding closed 4 years ago
I'm a fan of adding some measure of control over precision as well, not only in the net block but in others as well. However, my recollection is that runtime string formatting is not built-in to Rust, and I wasn't able to come up with a good way to implement this when I investigated at the time.
(Note: your other issue seems to be that the net block takes up too much space; you can resolve this by turning on/off the various widgets, as described in blocks.md
.)
Also, I think it's pretty pointless to show byte-level thoroughput in the net block -- it just leads to uninformative noise. Kilobytes should be the lowest unit.
OK i played around with implementing this a bit and i think this is a good implementation of what @SicariusNoctis suggested:
https://play.rust-lang.org/?gist=814e1d847d960a54690753c5c07fb56f [edited]
I really like this, it covers most of the formats i can think of.
Feel free to play around with it to see if it matches your idea.
@YodaEmbedding If you're still using i3status-rs, #704 should hopefully be what you wanted.
The net block has a few problems:
Noto Sans Regular
)The point of a status bar is to get a quick, rough estimate of usage. This means 2-3 digits of precision, e.g.
The aforementioned representations do not (significantly) vary in width with proportional fonts.
I propose a format specification:
where:
M
represents the limiting precision. (Anything below0.01M
is labeled0.00M
.).3
represents 3 digits of precision.That is: