feat(backlight): add use-actual-brightness option (#2380)

* add use-actual-brightness option

* added to changelog

* added to changelog 2

* added to changelog 3
This commit is contained in:
the 2021-02-16 04:02:33 -05:00 committed by GitHub
parent 4f16a4fb6d
commit 698b96d17b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -87,6 +87,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `internal/xworkspaces`: `%nwin%` can be used to display the number of open
windows per workspace
([`#604`](https://github.com/polybar/polybar/issues/604))
- `internal/backlight`: added `use-actual-brightness` option
### Changed
- Slight changes to the value ranges the different ramp levels are responsible
@ -106,6 +107,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([`#2292`](https://github.com/polybar/polybar/issues/2292))
- Parser error if click command contained `}`
([`#2040`](https://github.com/polybar/polybar/issues/2040))
- `internal/backlight`: With amdgpu backlights, the brightness indicator was slightly behind.
([`#2367](https://github.com/polybar/polybar/issues/2367))
## [3.5.4] - 2021-01-07
### Fixed

View File

@ -48,6 +48,7 @@ namespace modules {
string m_path_backlight;
float m_max_brightness;
bool m_scroll{false};
bool m_use_actual_brightness{true};
brightness_handle m_val;
brightness_handle m_max;

View File

@ -54,7 +54,10 @@ namespace modules {
* The only sensible way is to use the 'brightness' file instead
* Ref: https://github.com/Alexays/Waybar/issues/335
*/
std::string brightness_type = ((card.substr(0, 9) == "amdgpu_bl") ? "brightness" : "actual_brightness");
bool card_is_amdgpu = (card.substr(0, 9) == "amdgpu_bl");
m_use_actual_brightness = m_conf.get(name(), "use-actual-brightness", !card_is_amdgpu);
std::string brightness_type = (m_use_actual_brightness ? "actual_brightness" : "brightness");
auto path_backlight_val = m_path_backlight + "/" + brightness_type;
m_val.filepath(path_backlight_val);