I want to run script when my mac is idle (for example after 5 minutes or screen saver start time is also ok) and when I resume it from idle state.

I know that I can write daemon using NSDistributedNotificationCenter and com.apple.screenIsLocked and com.apple.screenIsUnlocked, but I hope that there is already solution without creating new daemon.

I need this to for example turn on/off speed limit for Transmission (as it is sometimes hard to work when hashing/downloading on full speed).

link|improve this question

62% accept rate
feedback

2 Answers

up vote 1 down vote accepted

Sleepwatcher -- See my answer to Automatically run a program when mac wakes from sleep

link|improve this answer
I see how you can script 'sleep' events, but not when your machine goes to idle / inactive. – brianegge May 31 '11 at 15:36
From Sleepwatcher's help text: -i or --idle execute idlecommand when no user interaction (keyboard, mouse) took place in the period given with the -t option. – JRobert May 31 '11 at 16:09
feedback

Look at the batch command:

man batch
link|improve this answer
Man page says about queueing at specific time or when load average drops below special value, nothing about idle/resume – tig May 12 '10 at 10:31
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.