Skip to content

Conversation

@werdl
Copy link

@werdl werdl commented Jul 5, 2025

Description

On OpenBSD, the apm (advanced power management) utility has a different output to that of FreeBSD and NetBSD. However, previously eww attempted to read in like the other BSDs, resulting in an unwrap error. This PR fixes this by implementing the required logic to parse the apm of OpenBSD. It also fixes the compile error regarding crate::regex. Finally, it fixes a warning on non-Linux systems, as std::fs::read_to_string is only used in target_os = "linux" code, but was included regardless.

Usage

There is no usage change for the end user, as the function is marked #[cfg(target_os = "openbsd")].

Additional Notes

I am unsure if OpenBSD's apm supports multiple batteries and I do not have the facilities to test this functionality, thus the suggested implementation assumes only one battery. If anybody happens to be running OpenBSD on a laptop with more than 1 battery, then testing there would be appreciated.

Checklist

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

  • All widgets I've added are correctly documented. (N/A)
  • I added my changes to CHANGELOG.md, if appropriate. (N/A)
  • The documentation in the docs/content/main directory has been adjusted to reflect my changes. (N/A)
  • 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