backlight_control icon indicating copy to clipboard operation
backlight_control copied to clipboard

Revamp

Open tricantivu opened this issue 1 year ago • 2 comments

Previously (i.e commit 9a79e0d), backlight_control would not validate the value argument and set unexpected brightness values.

For example:

backlight_control -100

Sets the current brigthness to 0.

Although Linux ensures the value set in /sys/class/backlight/<backlight>/brightness is between 0 and max_brightness, I think it would be nice to notify the user of invalid arguments.

Thanks for reading and I am open to feedback.

tricantivu avatar Jul 05 '23 04:07 tricantivu

Hi Alejandro,

Thanks for your interest and contribution :)

I agree with the technical changes (like ab68af529e1d4b34e6ccac5aa0dd3027f0f032b6), but I don't want to change the coding style (e.g. 2b2725d2d2d34abbafccbf47fa736278d660d2dc). Are you fine with cherry-picking just some of the commits from your branch?

Best, Hendrik

Hendrikto avatar Jul 05 '23 21:07 Hendrikto

I am fine with that @Hendrikto

Edit 1:

What do you think about replacing the conditional expression ((value < 0 ? value *= -1 : value)) for labs function from stdlib header?

if (labs(value) >= 1 && labs(value) <= 100)

tricantivu avatar Jul 06 '23 23:07 tricantivu