nriley / brightness

Command-line display brightness control for macOS.
BSD 2-Clause "Simplified" License
600 stars 54 forks source link

wondering what happens when you set only a specific display #30

Closed cad0p closed 4 years ago

cad0p commented 4 years ago

https://github.com/nriley/brightness/blob/1544a84fadf82730fde80db113560d8e8ce80292/brightness.c#L241-L243

Why do you continue without setting anything?

Thanks in advance, Pier Carlo Cadoppi

nriley commented 4 years ago

Short answer: It works!

Longer answer: Control flow is not exactly obvious there. The switch statement is inside a loop over all displays. If the display doesn't match either the display index (i) or the display ID (dspy), continue will check the next display and so forth. If the display does match, then control flow falls through to the ACTION_SET_ALL case which actually sets the brightness.

cad0p commented 4 years ago

Cool, thanks!

Maybe you have seen it, but on top of your package I have added on and off commands and renamed it to screenclean

So my thinking is: to clean my mac I would like a black window with full brightness

And as soon as I close that window, it should go back to the previous brightness (stored on file)

On Sun, Dec 15, 2019, 17:29 Nicholas Riley notifications@github.com wrote:

Short answer: It works!

Longer answer: Control flow is not exactly obvious there. The switch statement is inside a loop over all displays. If the display doesn't match either the display index (i) or the display ID (dspy), continue will check the next display and so forth. If the display does match, then control flow falls through to the ACTION_SET_ALL case which actually sets the brightness.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nriley/brightness/issues/30?email_source=notifications&email_token=ADLUHNWNGVPZFG6ECEZQQC3QYZLQNA5CNFSM4J25DK62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG44ZKA#issuecomment-565824680, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLUHNUJYRZPWBRHMOMONQDQYZLQNANCNFSM4J25DK6Q .