add EMA smoothing to CPU and temperature widgets - #2
Merged
Merged
Conversation
neoden
commented
Jan 26, 2026
Owner
- EMA smoothing for CPU and Temperature widgets to reduce flickering
- Rename average_seconds → smoothing_interval_seconds (breaking change)
- Warn about unknown config keys
There was a problem hiding this comment.
Pull request overview
This PR adds Exponential Moving Average (EMA) smoothing to CPU and Temperature widgets to reduce flickering in the status bar display. It also introduces a breaking configuration change by renaming average_seconds to smoothing_interval_seconds and adds warnings for unknown configuration keys to help users migrate.
Changes:
- Implemented new EMA utility package with comprehensive tests for exponential moving average smoothing
- Refactored CPU widget to use EMA instead of simple averaging, with updated tests
- Added EMA smoothing to Temperature widget
- Renamed config parameter from
average_secondstosmoothing_interval_seconds(breaking change) - Added detection and warnings for unknown/deprecated config keys
- Updated default smoothing interval from 5 to 3 seconds
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| util/ema.go | New EMA implementation with period-based alpha calculation and readiness tracking |
| util/ema_test.go | Comprehensive test suite for EMA functionality including edge cases |
| widgets/cpu.go | Refactored to use EMA smoothing instead of history-based averaging, added math.Round for display |
| widgets/cpu_test.go | Updated tests to verify EMA behavior instead of history management |
| widgets/temperature.go | Added EMA smoothing to temperature sensors with default interval handling |
| config/config.go | Renamed field and added unknown key detection with warnings to stderr |
| config/config_test.go | Updated tests for renamed field and added test for unknown key warnings |
| config.example.toml | Updated documentation with new parameter names and better descriptions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.