Mavericks is putting my app to sleep

[quote=158828:@Albin Kiland]I realise this is an old thread awaken from the the other side…but, Sam, this seems to work!
My app, that is a timer, was put to sleep if another app was run in Full Screen Mode…I’ll try to implement your solution and see what happens :)[/quote]
What is it that your application does on a timed basis? If you can instead of using a timer, switch over to registering for system events. This will allow your app to sleep and make it more energy friendly.

Sam, thanks for that. Solved the nightmare I was having with App Nap.

Another re-awakening of this old thread from the dead. However, it’s still popping up on Google so I thought I should update the information on preventing App Nap for El Capitan.

The terminal command to use now for preventing App Nap is:

defaults write com.mydomain.myappname LSAppNapIsDisabled -bool YES

You can verify that this instruction has worked by checking with ActivityMonitor>Energy when you app is running.

That will permanently disable it for your app
That may be less than ideal and really you should only block app nap when your app is doing something intensive
Sams code in https://forum.xojo.com/conversation/post/78698 makes that possible so you only disable it when you need to

Thanks Norman. I’m going to need to look into this more deeply anyway. Despite seemingly having App Nap turned off, my App is still slowing to an unacceptable crawl after about 5 minutes under El Capitan.

I was going to mention that the last time I experimented, setting this with defaults or NSUserDefaults made no difference for me. The only way I found to get full speed is to use the NSProcessInfo with NSProcessInfo.NSActivityUserInitiatedAllowingIdleSystemSleep.

Thank you Sam. What would be the Terminal commands to achieve what you are suggesting please?

The NSProcessInfo mechanism would be a bunch of declares you would have to call in your app
Not command line commands

As far as I know there isn’t a terminal command, it has to be via declares. I posted the code earlier, or if you have the MBS plugin I’m sure Christian has added it.

Thank you to both of you. I’m way out of my depth here (sigh!). I just want to get my app working full speed again like it did under Lion. Life seems to have suddenly become a lot more complicated!!

Sam, I looked at your example software NSProcessinfo-3, which Norman directed me to, but I have to admit that I don’t know enough to make any sense of it. Presumably I can just copy the elements into my app and simulate the checking and unchecking of the checkbox on initiation and exit? Would that work?

Thanks again for your help.

YES!! I’ve just answered my own question. It’s work beautifully. Thank you so much Norman and Sam!!

Glad to hear you have it working :slight_smile: