i3status-rust icon indicating copy to clipboard operation
i3status-rust copied to clipboard

Don't fail if no backlight device is available

Open marzzzello opened this issue 4 years ago • 10 comments

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"

marzzzello avatar Dec 13 '20 19:12 marzzzello

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?

ammgws avatar Dec 16 '20 04:12 ammgws

Yes, needed for shared config. I don't know of cases where the backlight device disappears

marzzzello avatar Dec 16 '20 17:12 marzzzello

I think I would accept a PR for that, though it might not be trivial to implement.

ammgws avatar Dec 28 '20 04:12 ammgws

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.

PremiumUsername avatar Apr 20 '21 12:04 PremiumUsername

@marzzzello What does actual_brightness report for your case?

Need to figure out the best way to make this possible.

ammgws avatar Apr 20 '21 13:04 ammgws

@marzzzello What does actual_brightness report for your case?

It goes from 0 (black screen) to 1515 (100%) My device is a Thinkpad T470

marzzzello avatar Apr 26 '21 12:04 marzzzello

Sorry I meant in the case when the backlight/monitor is absent.

ammgws avatar Apr 26 '21 22:04 ammgws

How should I test that? My monitor is integrated in the laptop

marzzzello avatar Apr 26 '21 22:04 marzzzello

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.

ammgws avatar Apr 26 '21 22:04 ammgws

Does this still happen with master (v0.30)?

ammgws avatar Jun 20 '22 13:06 ammgws

Instead the block should be hidden.

This is possible:

[[block]]
block = "backlight"
error_format = ""

MaxVerevkin avatar Jan 07 '23 17:01 MaxVerevkin