i3status-rust
i3status-rust copied to clipboard
formatting(eng): add `range` parameter
Closes #1957
Example
Show the cpu block only if utilization is above 10%:
[[block]]
block = "cpu"
format = " $icon $utilization.eng(range:10..) |"
Unresolved Questions
Support disjoint ranges? Would it be useful? How? Maybe by allowing multiple range arguments.
Todo
- [ ] Add examles to the blocks that would benefit from it.
- [x] Support half-ranges. Like
10...
For the partial ranges we can check to see if start/stop are empty strings and if so use f64's min/max values
Support disjoint ranges? Would it be useful? How? Maybe by allowing multiple range arguments.
My 2 cents would be that the usecase hasn't come up yet, as far as I can tell. Could be tackled if and when it does.
I think range(..25), range(75..) or range(..25,75..) would be ok. I think I prefer the two range parameters as it's easier to read. I also agree that could be added in another PR
Show the block only if less than 10GB is available:
[[block]] block = "disk_space" format = " $free.eng(range:..10e9) |"
Uhh. Do we want to support prefixes in ranges? Like range:..10Gi and range:..10M.
Show the block only if less than 10GB is available:
[[block]] block = "disk_space" format = " $free.eng(range:..10e9) |"Uhh. Do we want to support prefixes in ranges? Like
range:..10Giandrange:..10M.
That seems intuitive, could be done in another PR though as it wouldn't be breaking change