backlight: fix for percentage output for amdgpu_bl0 device (#336)

backlight: fix for percentage output for amdgpu_bl0 device
pull/339/head
Alex 2019-05-20 09:40:03 +02:00 committed by GitHub
commit 913d0f7ad0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -213,7 +213,9 @@ void waybar::modules::Backlight::upsert_device(ForwardIt first, ForwardIt last,
const char *name = udev_device_get_sysname(dev);
check_nn(name);
const char *actual = udev_device_get_sysattr_value(dev, "actual_brightness");
const char *actual_brightness_attr = strcmp(name, "amdgpu_bl0") == 0 ? "brightness" : "actual_brightness";
const char *actual = udev_device_get_sysattr_value(dev, actual_brightness_attr);
check_nn(actual);
const int actual_int = std::stoi(actual);