Hi all,
I have found a solution that works well.
If you create a shortcut on your Mac like this.
then you can run it as a terminal command from swift like this.
func setLaptopBrightness(brightness: Float){
let command = "shortcuts run 'Set Laptop Brightness' <<< \(brightness)"
let _ = shell(command)
}
or directly from terminal like this
shortcuts run 'Set Laptop Brightness' <<< 0.5
It works well for controlling your MacBook brightness programmatically until Apple lets us do it directly via Swift.
Thanks,
James
Topic:
App & System Services
SubTopic:
Hardware
Tags: