thompsonate / Shifty

☀️ A macOS menu bar app that gives you more control over Night Shift.
http://shifty.natethompson.io
GNU General Public License v3.0
1.24k stars 33 forks source link

Doesn't turn on automatically, and doesn't disable for disabled apps #40

Closed jeff-h closed 6 years ago

jeff-h commented 6 years ago

Basically the app does nothing for me! I have the schedule set to "Sunset to Sunrise" yet Night Shift does not come on at sunset. I can turn it on manually using Shifty, but then it fails to disable for any apps I set as "Disabled". "Disabled for an hour" does work.

I'm happy to build and debug a little but are you aware of anything that might cause the behaviour I'm seeing, or anywhere in particular I should start looking?

jeff-h commented 6 years ago

I've read through the code and think perhaps I am just misunderstanding how this is supposed to work.

I'm trying to:

Tracing this through the code, flow never goes inside the (rather frightening) logic here: https://github.com/thompsonate/Shifty/blob/master/Shifty/StatusMenuController.swift#L676-L679

...because isShiftForAppEnabled is set to false here: https://github.com/thompsonate/Shifty/blob/master/Shifty/StatusMenuController.swift#L578

...because scheduledState is false.

I've read through https://github.com/thompsonate/Shifty/blob/master/Shifty/StatusMenuController.swift#L218-L234 and come to the conclusion that it will never turn off night shift for a specific app if it's daytime, even if night shift is turned on via the "Turn on night shift".

Sorry if the above is all too verbose and hard to follow. Basically, I think if it's daytime, Shifty does not disable Night Shift for chosen apps even if Night Shift is on because I choose "Turn on Night Shift".

thompsonate commented 6 years ago

Thanks for looking into this and providing steps to reproduce. You're right, its a bug and my logic is rather frightening. I'm working on completely refactoring the core logic (even though I haven't touched it in a month). I'll get a version 1.0 out eventually and make sure it doesn't have this issue.

jeff-h commented 6 years ago

Thanks! Sorry I called it frightening — I rather meant it frightened me :) I suspect the logic simply isn't straightforward. Regardless, glad you've time to look into it — the app is really neat and I'd really like to use it!