Skip to content

Conversation

@topongo
Copy link
Contributor

@topongo topongo commented Jun 9, 2025

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: i64 of 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

image

Checklist

Please make sure you can check all the boxes that apply to this PR.

  • All widgets I've added are correctly documented.
  • I added my changes to CHANGELOG.md, if appropriate.
  • The documentation in the docs/content/main directory has been adjusted to reflect my changes.
  • I used cargo fmt to automatically format all code before committing

@topongo
Copy link
Contributor Author

topongo commented Jun 9, 2025

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.

@elkowar elkowar merged commit fddb4a0 into elkowar:master Jun 30, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants