Closed idoo closed 6 years ago
:) I'm using dark-mode all the time and on the latest osx and atom, it works perfectly :)
Take a look to package.json There is a package responsible for ambient light sensor. Anyway. It's also implemented already in Chrome, but not activated by default
yep, I looked on this, and even tried to compile it
maybe something wrong with my settings — are you using default values?
On more thing. Where are u using it? I mean in what environment. Atom package, node server, browser? On Thu, 1 Feb 2018 at 09:42 Ivan Verevkin notifications@github.com wrote:
yep, I looked on this, and even tried to compile it
maybe something wrong with settings — are you using default values?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Exelord/dark-mode/issues/3#issuecomment-362196839, or mute the thread https://github.com/notifications/unsubscribe-auth/ABZrv8d-Ab2W9AsjKIhnx1iTvI0mEEcmks5tQXkKgaJpZM4R1PAr .
now I'm trying your package in atom, is it possible to get some data from atom console? when I'm using
new AmbientLightSensorReading(null)
it returns
AmbientLightSensorReading {illuminance: 0, timeStamp: 325720.09}
for me
so, I guess there are no data from a sensor, isn't it?
I see, but is the package working correctly for you or it is just the problem with accessing the sensor package?
I install it, set parameters like here http://take.ms/wqZgy and put some light on my sensor, and nothing was changed :( then I tried to debug it from atom console, and don't know how to get access to sensor :(
Please ensure to turn auto mode to on
yep, I switched it on as well
Did you restart the atom? What kind of mac you have?
yep, I did, macbook pro 2016
Hmm, same. Is the switcher working correctly?
yep, I can switch manually, but can't automatically
I did debug here — lib/ambient-light.js:41
and looks value is always 0
even my screen is changing the brightness level
I have: Atom: 1.23.3 x64 mac os 10.13.3
darkMode = atom.packages.getAvailablePackages().find((p) => {return p.name == 'dark-mode'})
Ambient = require(`${darkMode.path}/lib/ambient-light`);
sensor = new Ambient();
sensor._lux();
Try it out in developer console and check what is the result of sensor._lux()
I did almost same when I put debugger in lib/ambient-light.js:41
— value is 0
maybe I have add/update some library?
:/ looks bad... and weird. Try to execute this file: https://github.com/jamo/ambientlight/blob/master/ambientlight.mm
Its definitely not a problem of the package, rather the system configuration.
yep, I think so
./ambientlight
failed to find ambient light sensors
@Exelord last question, do you have touchbar? looks like here is same issue with macbook with touchbar https://github.com/Dunedan/mbp-2016-linux/issues/16
No. :/ On Thu, 1 Feb 2018 at 11:06 Ivan Verevkin notifications@github.com wrote:
@Exelord https://github.com/exelord last question, do you have touchbar?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Exelord/dark-mode/issues/3#issuecomment-362218462, or mute the thread https://github.com/notifications/unsubscribe-auth/ABZrv6rqgbJHFSVOchAEvUg3Dt_PSkPlks5tQYyngaJpZM4R1PAr .
Same issue here. I tried your snippet above in Atom's console. Value is 0 as well. I believe I have the exact same issue as @idoo. I also have a MacBook equipped with their new (useless) touchbar. So it might be a good lead.
Im going to switch to native api https://developer.mozilla.org/en-US/docs/Web/API/Ambient_Light_Events
@Exelord sadly, it's doesn't work as well, coz as I got it's using same AppleLMUController
:(
and ask I can see it works only in FF now
checkout this example:
window.addEventListener('devicelight', function(event) { console.log('Light: ', event.value) })
It works, I have it already implemented. Just testing now for a few days to setup correct threshold
It is (partially) supported on chrome since quite some time so it should be supported by nodejs as well. However it does not work on my laptop (I just tried both your snippet and this website).
Hmm, in the latest atom it works perfectly fine
It does look like a good idea to rely on a standard (though unfinished). In that case you might choose to wait for Chromium to fix it (not sure when that will happen), meaning that you have nothing to do. An other option would be to wait for an update from ambientlight. Its maintainer mentioned that he was willing to have a look at it (c.f. https://github.com/jamo/ambientlight/issues/1).
I did
window.addEventListener('devicelight', function(event) {
console.log(event.value);
});
and there is no result in latest FF, Chrome, Safari
Could you try that one in the atom?
@QuentinRoy sure... For now, I will migrate to browser api, but depending what will came faster we will react with a proper fix.
looks like atom returns Infinity
if there are no sensor data
I will open a PR soon, so you will be able to test it
looks like it's doesn't work in FF
Chrome/Safari/ — both Not supported
Yes, but atom is based on chromium.
and we need only window.ondevicelight :)
Funny, in Atom it works, but with Infinity
as constant
I just tested in macbook 2017 without touchbar, where data though AppleLMUController
work well, and in Chrome ondevicelight
and AmbientLightSensor
is NotSupported
yes.. in chrome ondevicelight
is not supported yet. But chorme != chromium
I know, just funny :)
It looks like there is no support for now mackbooks yet :/ Or the API is private
@Exelord btw, https://github.com/Exelord/dark-mode/issues/2 partially it can solve our pain :) I used it same configuration in emacs and it works well based on geo-coordinates and sunrise data
Yes, that would be pretty cool feature :)
@Exelord navigator.geolocation.getCurrentPosition(console.log)
works well :)
https://github.com/mourner/suncalc
Look like getting current location is not possible in Atom. The only thing we can do is to use current timezone
@Exelord
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(msg) {
console.log(msg);
}, function(err) {
console.log(err);
});
} else {
error('not supported');
}
makes request to google, but it returns 400
"Network location provider at 'https://www.googleapis.com/' : Returned error code 400."
As option, it can be static longitude-latitude coordinates
Probably it require https://github.com/electron/electron/blob/master/docs/api/environment-variables.md#google_api_key
for history — asked for help in chromium issues tracker https://bugs.chromium.org/p/chromium/issues/detail?id=817725&can=2&start=0&num=100&q=-component%3ABlink%3ESensor%20&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=
@Exelord thank you for implementing this, I've looked to way how I can get access from light sensor in js :)
Does it work in current Mac OS? looks like we don't have access to sensor now, is it right?
I have macbook pro 2016: Atom: 1.23.3 x64 mac os 10.13.3