-
Notifications
You must be signed in to change notification settings - Fork 54
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
Support M1 Macs using DisplayServicesGetBrightness/DisplayServicesSetBrightness #36
Conversation
…Brightness - Tested on a M1 MacBook Air running Big Sur, for the built-in display. - Extracted functions from the main loop to avoid it getting too complicated. - Also made minor changes to fix a warning about `brightness` being uninitialized.
Thanks! Testing help appreciated. |
…layServicesSetBrightness" nriley#36.
…tness/DisplayServicesSetBrightness".
Thanks @jtbandes, this change works form me on both my M1 & Intel MacBooks 😄 However one line of the PR breaks |
@@ -151,7 +232,7 @@ int main(int argc, char * const argv[]) { | |||
|
|||
float brightness; | |||
if (action == ACTION_LIST) { | |||
if (argc > 0) usage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change breaks brightness -l
.
Not sure what the purpose is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to fix an uninitialized variable warning, but I guess I made a mistake. Thanks for catching — I’ll submit a fix soon.
@nriley, you might want to revert the |
Sorry, I did not mean to commit that as is. I've got a cleanup commit incoming. |
OK, updated and tested on all the Macs I have access to. Hopefully this works for everyone else too. Thanks again for the contribution! |
tested on M1 MacBook Pro 17,1. |
@new3gum2 are you building from source? If so, what macOS version and are you using the internal display? |
|
Can also confirm building from source works, but was getting the same error when I installed it with |
I found that these SPI functions work to get and set the brightness on my M1 MacBook Air. Fixes #34.
I have not tested this with any other system/configuration, so will need help from others to test thoroughly.
brightness
being uninitialized.