i3status-rust
i3status-rust copied to clipboard
No way to ask the formatter for a specific number of decimal places
I just upgraded from 0.14 or so to 0.20.2, and I ran into a problem upgrading my config – there's no way to have things like the disk space or memory blocks display e.g. always 1 decimal place any more.
I didn't think I'd mind this that much, until I realised that in order to avoid potentially getting padding added to the start of a number, you have to set the minimum width to 1. (otherwise, if e.g. you set the minimum width to 2, you'll get padding if the number is less than 10; if the minimum width is 3, you'll get padding if the number is between 10 and 99; and so on.) So now in order to avoid getting extra padding before the amount of memory in my system (#1231), I have to do something like this:
format_mem = "{mem_used:1;_G*_}/{mem_total:1;_G*_}"
which displays no decimal places at all, which is quite annoying.
Would you be interested in adding the ability to set the minimum width of the integer and fractional parts of floats separately? e.g. {mem_used:1.2}, which would display at least 2 digits after the decimal point.
Alternatively, making some way to avoid the padding entirely would be nice, since you could then e.g. ask for a minimum width of 3, and get "123GB", "12.3GB", or "1.2GB" (rather than " 12GB" like it currently does) – in situations where it currently adds padding, it could just add extra precision on the end.
I agree, it currently bothers me a bit as well that the new system can't do the "always n characters wide" the way it did before (See #240/#704) anymore...
I'd really like to make that work again, i feel like it was the ideal solution to have all values at a fixed width so the bar doesn't move around while also not having ugly padding.
So the issue here is with padding? I think if you don't mind your bar changing it's width, then se simplest solution is to add an option to disable the padding.
Yeah no the point is to have a bar that doesn't shift around, but also doesn't have ugly padding.
Just judging from the original post:
ask for a minimum width of 3, and get "123GB", "12.3GB", or "1.2GB"
You're right, that doesn't fit the idea from #240. ¯\_(ツ)_/¯