rstudio/rstudio — pull request #75 by jjallaire (2013-12-04 13:04:07+00:00)
Title: prevent osx mavericks AppNap when the R console is busy

This adds support for calling the AppNap API on OSX Mavericks to indicate that RStudio shouldn't be put in a low-power-consumption state when the R console is busy. See this discussion:

https://stat.ethz.ch/pipermail/r-sig-mac/2013-December/010581.html

See also this description of AppNap:

https://developer.apple.com/library/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_9.html

We take a conservative approach here, flagging RStudio as active but indicating that the full system can still go to sleep. This essentially provides the pre-Mavericks behavior (a running R console didn't count as something the system would stay awake for). We could indicate that the system itself shouldn't sleep, but this seems aggressive as it could result in a user's machine (surprisingly) never going to sleep when something as innocuous as a running httpuv application is keeping the R console busy.