Closed bim9262 closed 11 months ago
I think this kind of optimization has potential. In particular if we could actually skip expensive computation of values that are not used. For example, in net
block, we may entirely skip IP address fetch if it is not present in the format.
However I am not sure if doing so for backlight
or apt
makes much sense. brightness
and count
are most certainly present - why would anyone use this block but not use it's only feature?
As for icons, instead of resolving them immediately (as in Value::icon(api.get_icon("gpu")?)
), we can do so inside a formatter (so this becomes Value::icon("gpu")
). This way unused icons are never actually fetched, which takes care of #1774.
As for icons, instead of resolving them immediately (as in
Value::icon(api.get_icon("gpu")?)
), we can do so inside a formatter (so this becomesValue::icon("gpu")
). This way unused icons are never actually fetched, which takes care of https://github.com/greshake/i3status-rust/issues/1774.
I like that! I'll give that a go. We'll need to handle the icon progressions in the formatter too...
Looks great!
See #1774
Let me know if you think this is a good approach to only set the required values needed based on the format that's being used.