On 28 Nov 2013, at 14:38, John Fox <[email protected]> wrote:

> Dear Peter,
> 
> On Thu, 28 Nov 2013 12:00:31 +0100
> peter dalgaard <[email protected]> wrote:
>> 
>> On 28 Nov 2013, at 01:46 , John Fox <[email protected]> wrote:
>> 
>>> Hi Rob,
>>> 
>>> I had some time today and so I started to implement this solution in the
>>> Rcmdr. I first tested whether setting
>>> 
>>> system("defaults write org.R-project.R NSAppSleepDisabled -bool yes")
>>> 
>>> fixes the problem; I verified via 
>>> 
>>> system("defaults read org.R-project.R NSAppSleepDisabled")
>>> 
>>> that the key was in fact set properly. 
>>> 
>>> I'm afraid that even with NSAppSleepDisabled set, the Rcmdr still freezes
>>> periodically. Whatever is going on is probably more complicated than
>>> power-saving.
>>> 
>> 
>> Hmm. The tkfaq issue seems to have gone away for me. You did remember to 
>> restart R.app after setting the key?
>> 
> 
> I didn't "remember" to restart R.app because I didn't know that it was 
> necessary to do so. In fact, the code that I wrote, but didn't commit, for 
> the Rcmdr carefully resets the key to its previous state or deletes it if it 
> didn't previously exist when the Commander is closed.
> 
> I think that you've almost surely identified my problem, but the solution 
> also raises a question about what to do. I'm reluctant to have the Rcmdr make 
> a permanent change to users' OS settings. I guess that I could detect whether 
> the NSAppSleepDisabled key is set and pop up a dialog box if it isn't, 
> offering to make the change, and suggesting that the user restart R.app. 
> (BTW, is there an easy way to check whether R is running in R.app or a 
> terminal?)

Look at svMisc::isAqua(), which uses indeed .Platform$GUI returning "Aqua" on 
R.app or "X11" on R under a terminal. I am not sure, however, that R on a 
terminal returns *always* "X11".
Best,

Philippe

> Wouldn't it be better to handle this issue in R.app or even in tcltk, however?
> 
> If restarting R.app after setting the NSAppSleepDisabled key doesn't work for 
> me, I'll then pursue Rob's suggestions.
> 
> Thanks for this,
> John




[…]
_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to