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

Not remembering disable settings #70

Closed thefella closed 5 years ago

thefella commented 5 years ago

I have it disabled for programs like Photoshop, Lightroom, and VLC, but if I restart my machine, Shifty won't remember this and I have to make sure it ignores the programs all over again. I'm running 1.0.2.

thompsonate commented 5 years ago

That's odd. I'll look into it.

choco commented 5 years ago

Can you still reproduce the issue? Have you tried resetting the preferences? (when you reset them in Mojave there is a bug that forces you to restart the system before reopening the app or the preferences will get restored and can get corrupted)

thefella commented 5 years ago

Happens every time I restart. I've deleted the prefs file and restarted multiple times. Still won't remember the disabled programs.

thompsonate commented 5 years ago

Hmm, just received a (very nice) bug report on this via email:

Dear Nate Thompson,

Shifty has been an excellent macOS app for me and I really appreciate the effort you have put into it.

However, there is something about one of the app’s key feature that is bothering me lately. To be more specific, the “Disable for XXX app” feature will always stop working when Shifty is relaunched.

For example, I don’t want Night Shift to be turned on whenever I am editing videos, so I chose “Disable for Final Cut Pro” in Shifty. But every time as I reboot the system, although Shifty would automatically relaunch at login, Night Shift still turns on at night regardless of FCP’s running or not, unless I disable it again in Shifty.

I hope that this “Disable for XXX app” setting can be persisting, unlike a one-time command, or at least we users can choose whether to disable Night Shift for that app entirely or just for, say, a single night.

I know this may be a lot to ask, and it’s absolutely fine if you decide not to make new changes to the app right now, but I would like to know if you are aware of this issue and if it is intentional.

Waiting to hear from you soon, McCoy Zhu

choco commented 5 years ago

I can't reproduce it on my setup. It would really help if anyone reproducing this could upload their preferences file (~/Library/Preferences/io.thomposnate.shifty.plist), post the log file and try the following procedure:

  1. in terminal type defaults read io.natethompson.Shifty disabledApps
  2. save output and post it here
  3. make a new app disabled
  4. in terminal type again defaults read io.natethompson.Shifty disabledApps
  5. save output again and post it here
  6. restart the app and in terminal type again defaults read io.natethompson.Shifty disabledApps
  7. post also the output of the above command
zhumingcheng697 commented 5 years ago
  1. in terminal type defaults read io.natethompson.Shifty disabledApps
  2. save output and post it here
  3. make a new app disabled
  4. in terminal type again defaults read io.natethompson.Shifty disabledApps
  5. save output again and post it here
  6. restart the app and in terminal type again defaults read io.natethompson.Shifty disabledApps
  7. post also the output of the above command

So I have tried these steps and there is something really interesting with the output. Every time a new app is disabled, ^fullScreenOnly_bundleIdentifier_XXX (in hexadecimal format) is added to the pref file, as intended, and it would still be there after Shifty is relaunched. However, if I disable another app now that Shifty has been relaunched, all the previous entries get erased and this app becomes the only one that is listed in that pref file.

My wild guess is that:

  1. Due to some unknown reasons, Shifty cannot access its original pref file after it has been relaunched — which explains why Shifty no longer disables Night Shift for designated apps after relaunch.

  2. Although the pref file is somehow unaccessible for Shifty, it is still at where it used to be and accessible for terminal.

  3. When I try to disable another app, since Shifty has failed to access its original pref file, it creates a new one at the same place, and the original one gets replaced by the new one — which explains why all the previous entries are gone and there is only the newly disabled app present.

If such is the case, we just have to figure out why Shifty cannot access its original pref file, and if this problem is resolved, everything should work perfectly fine.

PS: I am using a Simplified Chinese system language, and I don't know if it has anything to do with this bug.

thompsonate commented 5 years ago

Okay, I figured out how to reproduce this. If you don't have both browser rules and app rules saved, it'll skip importing the saved preferences for the one that was saved. Just a dumb coding mistake.

Will post a binary here soon so we can make sure that fixes the issue and I'll put out an update soon.

thompsonate commented 5 years ago

@thefella @zhumingcheng697 If you could, please check this version and make sure it solves your issue.

Shifty.app.zip

zhumingcheng697 commented 5 years ago

@thompsonate Great, it's working now!

thefella commented 5 years ago

I can't check if this is working, as the new version you sent won't open/run on my Mojave beta version (10.14.5 beta). I've installed the stable version of Shifty and it works as before.

zhumingcheng697 commented 5 years ago

@thefella I guess it’s just some signing / macOS gatekeeper issue. Try press option and double tap the app icon to open it.

thefella commented 5 years ago

@zhumingcheng697 Nope, I tried that and that didn't work. I also tried deleting all files, restarting my Mac, checking permissions, and it still wouldn't open.

zhumingcheng697 commented 5 years ago

@thefella That's weird. I worked for me back on 10.14.5 beta 1 (18F96h). Now that I've updated to the latest 10.14.5 beta 2 (18F108f), I also have no difficulties in launching Shifty (1.0.3b2).

thompsonate commented 5 years ago

@thefella Can you get info and check the version number? I accidentally uploaded a version that was crashing on launch, but fixed it before either of you commented.

thefella commented 5 years ago

@thompsonate I re-downloaded the file and it seems to be launching now! Maybe I was quick off the mark and downloaded the broken version. All seems to be good now. Good work!

thompsonate commented 5 years ago

Great, thanks everyone for your help!

Trying to fix a few other issues and I'll push out an update soon.