eww
eww copied to clipboard
add `formatbytes` to expressions
Description
add the formatbytes function to eww expressions.
this is a format successor of #1271, by leveraging the bytesize crate we can format byte numbers (very common on eww, see EWW_NET, EWW_DISK) in a human readable format.
Usage
formatbytes(bytes, short, format_mode): Display bytes in a human-readable format. Arguments:bytes:i64of bytes, supports negative sizes.short: set true for a compact version (default: false)format_mode: set to either to "iec" (eg.1.0 GiB) or "si" (eg.1.2 GB) (default: "iec")
Showcase
Checklist
Please make sure you can check all the boxes that apply to this PR.
- [x] All widgets I've added are correctly documented.
- [x] I added my changes to CHANGELOG.md, if appropriate.
- [x] The documentation in the
docs/content/maindirectory has been adjusted to reflect my changes. - [x] I used
cargo fmtto automatically format all code before committing
i apologize for not noticing #1277... i guess this is a duplicate then. the implementation is similar, apart the fact that i'm using an external crate for the actual format.