Skip to content

handle all battery states provided by the kernel - #3

Merged
neoden merged 3 commits into
masterfrom
feature/battery-status
Jan 27, 2026
Merged

neoden merged 3 commits into
masterfrom
feature/battery-status

Conversation

@neoden

@neoden neoden commented Jan 27, 2026

Copy link
Copy Markdown
Owner
  • Handle all Linux battery statuses (Charging, Discharging, Full, Not charging, Unknown)
  • Hide temperature widget until EMA is warmed up

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates widget behavior to better reflect Linux kernel-reported battery states and to avoid showing temperature output until EMA smoothing has enough samples.

Changes:

  • Replace IsCharging with a BatteryState enum and parse /sys/class/power_supply/*/status into it.
  • Adjust battery hide/show logic to use “on AC” vs “not on AC” semantics derived from BatteryState.
  • Hide temperature widget output until the EMA is “ready” (warmed up), updating tests accordingly.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
widgets/temperature.go Gate temperature display on EMA readiness to avoid early/noisy readings.
widgets/temperature_test.go Prime/initialize EMA in tests so temperature GetBlock tests remain meaningful with readiness gating.
widgets/battery.go Introduce BatteryState, parse kernel status strings, and update hide/charging logic to use state.
widgets/battery_test.go Update tests to assert on BatteryState and expand hide-logic coverage for additional states.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread widgets/battery.go
Comment thread widgets/battery.go Outdated
Comment thread widgets/battery.go
Comment thread widgets/temperature.go
@neoden neoden self-assigned this Jan 27, 2026
@neoden
neoden merged commit 37b3968 into master Jan 27, 2026
2 checks passed
@neoden
neoden deleted the feature/battery-status branch January 28, 2026 06:13
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