i3status-rust icon indicating copy to clipboard operation
i3status-rust copied to clipboard

feature_request(memory): treat `swap_used` zero value as `false` in conditions

Open UnkwUsr opened this issue 2 years ago • 2 comments

Problem

Formatting doc says (if I understand it correctly) that we can write conditions like Percentage: $percentage|nothing here.

I would like to make memory block hidden when swap_used is zero, so I'm trying format = "$swap_used|nothing" but it shows "0B".

Possible solutions

  1. Maybe hack swap_used so zero value will fallback to category "missing placeholder"?
  2. Add formatter option for type Number, like ignore_zero or ignore_threshold. This is more general approach.

UnkwUsr avatar Oct 24 '23 17:10 UnkwUsr

Add formatter option for type Number, like ignore_zero or ignore_threshold. This is more general approach.

I like this. Or even add an option to .eng formatter. Maybe .eng(allow:1..100) or something.

MaxVerevkin avatar Oct 24 '23 20:10 MaxVerevkin

Maybe .eng(allow:1..100) or something.

So the above came up as a potential solution for #1768 as well. Usecase being: showing disk usage, memory usage and other blocks conditionally. Should we rephrase this issue a little broader to encompass that? Or maybe create a new issue that specifically mentions the creation of an (allow:1..100) formatter?

ismay avatar Apr 13 '24 13:04 ismay