Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in hs.brightness.set() #2312

Open
latenitefilms opened this issue Feb 28, 2020 · 7 comments
Open

Bug in hs.brightness.set() #2312

latenitefilms opened this issue Feb 28, 2020 · 7 comments

Comments

@latenitefilms
Copy link
Contributor

On macOS 10.14.6 I'm seeing:

> hs.brightness.set(80)
true

> hs.brightness.get()
79

> hs.brightness.set(81)
true

> hs.brightness.get()
80

Can you reproduce @cmsj or @asmagill ?

@latenitefilms
Copy link
Contributor Author

Also, hs.brightness.ambient() isn't working on my MacBook Pro (15-inch, 2017). I'm just getting -1.

@dasmurphy
Copy link

dasmurphy commented Mar 15, 2020

@latenitefilms I can reproduce it on my 10.14.6 too. Same values here.

It is a MacBook Pro 15 also a 2017 model.

@pedrorrivero
Copy link

pedrorrivero commented Aug 22, 2020

Same thing going on here, any news? Also, I noticed that the brightness scrollbar does not get updated when a new brightness is set trough the API.

@latenitefilms
Copy link
Contributor Author

Thoughts on this @asmagill or @cmsj ?

@asmagill
Copy link
Member

asmagill commented Mar 2, 2021

The brightness value used by both the IOKit approach and the newer DisplayServices approach used for M1 is actually a double type. The brightness module internally converts this to/from an integer between 1 and 100. I suspect that rounding and machine approximations are causing this.

hs.screen:get/setBrightness keeps everything a double, so it will probably be more consistent.

@cmsj
Copy link
Member

cmsj commented Mar 2, 2021

yeah I'm pretty sure @asmagill is right here. The question is, should we deprecate hs.brightness:get() and :set()?

@asmagill
Copy link
Member

asmagill commented Mar 2, 2021

That would leave only hs.brightness.ambient in the brightness module. It isn't monitor specific, so it shouldn't be moved into hs.screen as a method, but with proper documentation, it might not be a horrible fit as a function.

Or we could just make it something like hs.ambient and put it in at the "top level".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants