Skip to content

feat: add battery/power source module for issue #52#55

Open
ShadyUnderLight wants to merge 1 commit intomainfrom
feat/issue52-power-source-module
Open

feat: add battery/power source module for issue #52#55
ShadyUnderLight wants to merge 1 commit intomainfrom
feat/issue52-power-source-module

Conversation

@ShadyUnderLight
Copy link
Copy Markdown
Owner

Summary

  • Add BatteryStatus enum (charging/discharging/full/noBattery) and PowerSourceInfo struct
  • Add .power flag to PopupModuleVisibility OptionSet
  • Add PowerSourceProvider using IOKit to read battery state (percent, charging status, time remaining)
  • SystemSummary now includes powerSource: PowerSourceInfo from SystemMetricsProvider
  • MenuBarContentView shows battery section only when .power enabled AND device has a battery
  • Graceful degradation on desktop Macs without battery (shows nothing instead of misleading content)
  • Localization strings for battery status and time remaining (en/zh-Hans)
  • 6 unit tests for PowerSourceInfo formatting and localization

Acceptance criteria

  • Battery percentage display
  • Charging/discharging status
  • Time remaining or graceful "unavailable" message
  • Compatible with existing popup / menu bar templates
  • State mapping and formatting tests added

Testing

  • 129 tests pass
  • Build succeeds

- Add BatteryStatus enum and PowerSourceInfo struct to SystemModels
- Add .power flag to PopupModuleVisibility
- Add PowerSourceProvider using IOKit to read battery state
- SystemSummary now includes powerSource from SystemMetricsProvider
- MenuBarContentView shows battery section when .power enabled and hasBattery
- Localization strings for battery status and time remaining (en/zh-Hans)
- 6 unit tests for PowerSourceInfo formatting and localization
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