Compare commits

...

2 Commits

Author SHA1 Message Date
Patrick Ziegler 8e04f15ed6
fix(backlight): %backlight% token appearing on the bar (#3081)
* Fix backlight initial value matching the actual brightness level

The initial value is `0`. If the actual brightness is also `0` you see
`%percentage%` token as text, it’s not being replaced. Since
`m_brightness` is an `int` the initial value could be just `-1` since
the actual brightness is never goes below zero. Thus this bug will never
show up again because actual brightness on first render won’t match
the “old” `m_brightness` value.

See also for more detailed explanation of the bug:
https://github.com/polybar/polybar/discussions/3079#discussioncomment-8169932

* Add docs

---------

Co-authored-by: Viacheslav Lotsmanov <lotsmanov89@gmail.com>
2024-01-20 18:09:12 +01:00
patrick96 0ed669f049
fix(doc): Update vulnerable rtd search extension
Ref: https://github.com/readthedocs/readthedocs-sphinx-search/security/advisories/GHSA-xgfm-fjx6-62mj
2024-01-20 17:53:28 +01:00
3 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -4,4 +4,4 @@
sphinx~=7.2.6
sphinx-rtd-theme~=2.0.0rc2
sphinx-notfound-page~=1.0.0
readthedocs-sphinx-search~=0.3.1
readthedocs-sphinx-search~=0.3.2

View File

@ -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<double> m_interval{};
chrono::steady_clock::time_point m_lastpoll;