diff --git a/CHANGELOG.md b/CHANGELOG.md index 386452a2..010b678f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- `internal/backlight`: Module could display the literal `%percentage%` token if the backlight reports a value of 0 at startup ([`#3081`](https://github.com/polybar/polybar/pull/3081)) by [@unclechu](https://github.com/unclechu) ## [3.7.1] - 2023-11-27 ### Build diff --git a/include/modules/backlight.hpp b/include/modules/backlight.hpp index 685814dd..f878643d 100644 --- a/include/modules/backlight.hpp +++ b/include/modules/backlight.hpp @@ -67,7 +67,12 @@ namespace modules { brightness_handle m_val; brightness_handle m_max; - int m_percentage = 0; + /** + * Initial value set to a negative number so that any value read from the backlight file triggers an update during + * the first read. + * Otherwise, tokens may not be replaced + */ + int m_percentage = -1; chrono::duration m_interval{}; chrono::steady_clock::time_point m_lastpoll;