-
Notifications
You must be signed in to change notification settings - Fork 787
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
Automatically adjust external display based on internal display + Touch Bar support #27
Comments
Hi @funbben, Thats a great idea but would be quite difficult to implement because this feature depends on the ambient light sensor (located next to the camera) of your Macbook Pro/iMac and not all external screen have one. I'll leave this issue open for now to see if anyone has a better idea about tackling this. PS. We could, for exemple use the one present on your MBP/iMac if we have one, but I'm not sure how. I'll look into it. |
The idea was to use mac internal sensor and apply same setting as Mac display |
I think the idea @funbben described is actually very interesting. The only thing is: One will have to check first whether the computer is a laptop and whether it is running the clamshell mode or not. |
Hammerspoon provides the lux reading from the ambient light sensor on Macs. Apprently they use the raw value from the sensor and run Mozilla's algorithm to convert it to lux |
@rowanalex123 Have you actually tried that? The function only returns an error for me -- which is a -1 (on MacBook Pro 2016). |
I tried it now. It returns -1 for me as well on a 2017 Mac pro |
I would really like this idea with using the Mac Books ambient sensor. Has someone already tried this code for reading the data? I think I'm gonna play around a bit with it soon |
Hi, first of all sorry for the late response. |
Just something that might be of interest. The new LG 2019 Ultrafine 5k is finally using the light sensor (see https://twitter.com/jonatan/status/1167163794281455616) so maybe there's a chance to use that information to automatically change others' display brightness (probably with a configurable offset for the value) |
Another interesting fact, looks like now even the older LG Ultrafine 5k that didn't have the auto-brightness working now it's enabled if you are on Catalina. |
Just found this app, mainly because I'd like to have different brightness during the day and in the evenings, and immediately thought of this idea. Has anyone had any luck reading ambient light values? I might help, I do swift for a living. |
|
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require attention? This issue may be closed if no further activity occurs. Thank you for your contributions. |
Feature request is still pending. Commenting so it's not auto-closed. |
This might be a bit out of focus for MonitorControl right now but still we might add this function in the future as apparently this is among the core ideas all the way back to 2018. :) There is an app called Lunar however made by @alin23 that already does this thing for those who are impatient for a solution. |
Thanks @waydabber for letting people know about Lunar! Indeed, Lunar has Sync mode which takes advantage of Automatically adjust brightness by syncing the already adjusted brightness of the built-in display to the external monitors. The problem with reading the sensor directly is that:
If anyone is interested in reading the lux value on M1 Macs, because that is possible there, here is how to retrieve it from the command line: ioreg -r -c AppleSPUCT720 | awk '/CurrentLux/{print $4}' Doing that in Swift would require iterating the I/O Kit registry by matching the class #!/usr/bin/env swift
import IOKit
import Foundation
func getLux() -> Float? {
let sensor: io_service_t
if #available(macOS 12.0, *) {
sensor = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching("AppleSPUCT720"))
} else {
sensor = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("AppleSPUCT720"))
}
guard sensor != 0 else {
return nil
}
guard let luxProp = IORegistryEntryCreateCFProperty(sensor, "CurrentLux" as CFString, kCFAllocatorDefault, 0),
let lux = luxProp.takeRetainedValue() as? Float
else { return nil }
return lux
}
print(getLux() ?? -1) |
Wow @alin23 thanks for the detailed info! I wanted to go on the route of reading the internal display brightness (as that will also help on an other request, namely the use of the MBP touch bar slider for brightness change - I think we have a similar situation there that we can only infer the selected brightness only from the display's brightness itself, but I am not entirely sure, since I don't have an MBP myself and hate the idea of the touchbar. :)) But there is a rather long list of other accumulated issues to be dealt with so I am afraid this one does not have the highest prioirty at the moment. |
Here is what we can do regarding the ambient light sensor, the touch bar slider and the Control Center brightness slider:
Based on this, we can do brightness change replication from the internal display to the external displays. The issues are still numerous:
This issue is related if we want all out synchronization: #418 I am not yet sure where to go with this and how well would the end result work. :) |
Just some info about the progress regarding this issue:
|
Brightness change synchronization from Built-In and Apple displays to other displays is now added. This makes Touch Bar, Ambient light sensor, Control Center and System Preferences induced changes affect all displays. Synchronization is not direct, but only changes are replicated - the user can intervene and adjust at any time. |
It would be nice to be able to use the mac "auto adjust brightness" to set the brightness of external display automatically
https://i.stack.imgur.com/eYQuM.png
The text was updated successfully, but these errors were encountered: