Help with BuiltInDisplayBrightness

Hey all- I've been playing with BTT for a while now and everything is great.

The only thing I just can't get to work is getting display brightness value to show on the bar. I understand that the Dynamic Variable "BuiltInDisplayBrightness" had issues with big sur, possibly m1. The brightness slider had the same can slide to change the brightness but the handle would drop back to left position or 0 but brightness would hold. It seemed like the value of "BuiltInDisplayBrightness" resets back to 0 without affecting brightness level.

But the slider has been fixed and now works properly. The Dynamic Variable still has the same issue. Is there a new variable that I can use? A work around? If someone can provide the script behind the working brightness slider, I can probably figure it out. Been trying to get this to work for weeks...thanks anyone and everyone!

Possibly try the latest alpha (3.558), I did some modifications that might help!

Thanks! Just updated but not sure what I'm looking for yet.

Edit: Noticed 3.558 made some apps have white background in the touchbar...being that some buttons with rounded corners have white corners now.

Touch Bar Shot 2021-02-25 at 8.38.23 AM

Edit 2: It seems any time the touchbar has more things than it can fit, it does this...which mostly isn't much of a problem for me except when I use the dock widget and there are more apps running than the touchbar can hold.

Edit 3: Not an issue with dock widget either after making the width smaller. Small bug but doesn't affect me...the variable still does not respond with any value over 0. Can you point to what I'm looking for? Thanks!

Looked all day for changes that might help with this but couldn't find. Could you give a hint on where to look to get brightness reading like BuiltInDisplayBrightness? Much appreciated.

I just updated the code for the BuiltInDisplayBrightness slightly, hoping that it would fix the issue for you. If it still doesn't work with that I need to look again.

tell application "BetterTouchTool"
	get_number_variable "BuiltInDisplayBrightness"
end tell

Not sure if it's an M1 thing. Still returning 0.0 as value with this. :slightly_frowning_face:

Seems like it is an M1 + Big Sur thing. After more research found running this:

set brightlvl to do shell script "/usr/libexec/corebrightnessdiag status-info | grep -w DisplayServicesBrightness"

returns this:

"				<key>DisplayServicesBrightness</key>
 DisplayServicesBrightness = \"0.5\";"

Then...tweaked a little:

((((word 10 of (do shell script "/usr/libexec/corebrightnessdiag status-info | grep -w DisplayServicesBrightness")) * 100) as integer) as string) & "%" returns just the brightness percentage of display.

Not sure if I'm doing this correctly...but works for me for now. Hopefully this might help you troubleshoot. If BuiltInDisplayBrightness gets fixed for M1, I'd rather use that than something I hacked up...Takes me forever to get something to work. Not a coder. Thanks again.

1 Like

That whole chunk returned some errors so had to break it down. Final version of my volume/brightness value/indicator if anyone else will find it useful:

tell application "BetterTouchTool"

set volumelvl to (get_number_variable "OutputVolume") * 100 as integer
set brightval to word 10 of (do shell script "/usr/libexec/corebrightnessdiag status-info | grep -w DisplayServicesBrightness")
set brightlvl to brightval * 100 as integer

end tell

if volumelvl is equal to 100 then
set volumelvl to "Max" as string
else if volumelvl is greater than or equal to 10 then
set volumelvl to volumelvl & "%"
else if volumelvl is less than 10 then
set volumelvl to text -2 thru -1 of ("0" & volumelvl) & "%"
end if

if brightlvl is equal to 100 then
set brightlvl to "Max" as string
else if brightlvl is greater than or equal to 10 then
set brightlvl to brightlvl & "%"
else if brightlvl is less than 10 then
set brightlvl to text -2 thru -1 of ("0" & brightlvl) & "%"
end if

return "{"text":":loud_sound: " & volumelvl & "\nā€‹:sunny: " & brightlvl & ""}"

Touch Bar Shot 2021-02-26 at 6.21.32 AM

1 Like