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

Implement Set-MonitorBrightness #22

Open
1 of 3 tasks
Tracked by #18
StefanGreve opened this issue Dec 25, 2024 · 0 comments
Open
1 of 3 tasks
Tracked by #18

Implement Set-MonitorBrightness #22

StefanGreve opened this issue Dec 25, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request linux Issues affecting the Linux operating system macos Issues affecting the MacOS operating system windows Issues affecting the Windows operating system

Comments

@StefanGreve
Copy link
Owner

StefanGreve commented Dec 25, 2024

TODO

  • Windows
  • MacOS
  • Linux

Note: Keep this issue open until all three platforms have been covered.

About

MacOS

There are third-party libraries that can do this, such as brightness but I am trying to avoid pulling in dependencies as much as possible.

Running Apple Script works, but it will require access to accessibility features in the settings menu of the terminal application on the first run.

# reduce brightness by 1/16, use key code 113 to increase the brightness by 1 bar 
osascript -e 'tell application "System Events"' -e 'key code 107' -e ' end tell'

Interestingly enough, there are two set of key codes for sending key strokes to adjust brightness [1], i.e.

Key Code Function
107 decrease
145 decrease
113 increase
144 increase

Preferably, I would also need a way to get the current brightness value. In theory I could reset the brightness to 0% and then work my way up to the requested values, by mapping all integers from [0,100] to [0,16], but that's far from ideal.

References

@StefanGreve StefanGreve mentioned this issue Dec 25, 2024
11 tasks
@StefanGreve StefanGreve added enhancement New feature or request linux Issues affecting the Linux operating system windows Issues affecting the Windows operating system macos Issues affecting the MacOS operating system labels Dec 25, 2024
@StefanGreve StefanGreve self-assigned this Dec 25, 2024
@StefanGreve StefanGreve changed the title Implement Set-MonitorBrightness Implement Set-MonitorBrightness Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request linux Issues affecting the Linux operating system macos Issues affecting the MacOS operating system windows Issues affecting the Windows operating system
Projects
None yet
Development

No branches or pull requests

1 participant