Skip to content

Conversation

spflaumer
Copy link

@spflaumer spflaumer commented Jun 7, 2025

Description

Hello everyone,
eww currently crashes when launched on OpenBSD, as the output from OpenBSD's apm tool isn't similar to the one from FreeBSD, which has a slightly different format from FreeBSD (NetBSD could potentially suffer from the same issue).

I've thus written an OpenBSD specific battery statistics handler, which simply obtains the information from the sysctl interface to acpibat (with acpisbs currently lacking an implementation).

Additionally, the OpenBSD specific handler will return a dummy JSON string, instead of crashing outright, if it can't launch one of the two programs.

Also, this is the first time I've written anything serious in Rust, and only the second time I've written Rust at all, so the code is almost certainly terrible.

Additional Notes

  • only the acpibat driver code has been implemented and no fallback to apm is currently done when a battery that uses acpibat isn't discovered. (most likely, the only change necessary will be to remove acpibat from the regex, but since I don't have a system where the acpisbs driver would initialize I don't have a quick and easy way to confirm that they work the same way)
  • some codepaths use .unwrap(), and will crash the whole daemon, even though a simple fallback to a dummy JSON string could be performed

Checklist

  • 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

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.

1 participant