i3status-rust
i3status-rust copied to clipboard
Don't fail if no backlight device is available
Related to #568
If there is no device under /sys/class/backlight and there is no device specified in the block, then the bar should not fail.
Instead the block should be hidden.
[[block]]
block = "backlight"
Is this purely so you can share the same config between, for example, a laptop and a desktop? Or are there cases when the backlight is actually unavailable?
Yes, needed for shared config. I don't know of cases where the backlight device disappears
I think I would accept a PR for that, though it might not be trivial to implement.
Is this purely so you can share the same config between, for example, a laptop and a desktop? Or are there cases when the backlight is actually unavailable?
There are such user cases:
If you have a portable monitor, and you use the driver for ddc in order to enable brightness control it's very convenient to use the brightness block to control the brightness for that monitor when it is connected.
In my case there would be a device but actual_brightness would be reported as -110 when the monitor is absent.
@marzzzello What does actual_brightness report for your case?
Need to figure out the best way to make this possible.
@marzzzello What does
actual_brightnessreport for your case?
It goes from 0 (black screen) to 1515 (100%) My device is a Thinkpad T470
Sorry I meant in the case when the backlight/monitor is absent.
How should I test that? My monitor is integrated in the laptop
Actually don't worry, I mixed up your case with the other one in this thread. Your issue is due to sharing configs with another PC that doesn't have a backlight.
Does this still happen with master (v0.30)?
Instead the block should be hidden.
This is possible:
[[block]]
block = "backlight"
error_format = ""