First stab at brightnessctl based script + update 1:
UPDATE: Fixed ipeak going negative, substituted “snore” function instead of sleep for better memory / pid consumption.
Its jank and needs a ton of cleanup, but so far it works. I would be happy to have feedback, regarding more elegant ways to do this code (even in other languages), or ways to make it more performant / lower overhead.
Script does everything I explained in last post, but still finding little errors and invalid values that need trapped…
I set it up so that there is a linear increase in brightness with illumination_raw to some peak value, in which case brightness will be full from there on up. Manually adjusting brightness just pulls that peak value up or down to bias the calculation. So it takes more than a few button presses of brightness up or brightness down before the auto adjust loop will settle on the value that you like.
Might want to edit the initial value of the ipeak variable to suit your preferences.
Oh and don’t run two copies of the script at once by accident, as they will fight each other can give weird results!