Reputation: 17778
I've found many useful Bash commands that can execute OS X behaviors from the command line such as:
screencapture -x -C $FILENAME
Is there such a command that can check if the screen saver is active?
Upvotes: 5
Views: 4264
Reputation: 311
I am using this:
ps ax|grep [S]creenSaverEngine > /dev/null
if [ "$?" != "0" ] ; then
# screen saver is not active
else
# screen saver is active
fi
Upvotes: 12
Reputation: 3130
My Mac is at home and I'm not, so I can't test this solution, but how about something like:
ps -ef | grep [s]creencapture > nul; echo $?
The [] brackets prevent grep from matching this grep command while allowing it to match all other commands containing "screencapture". (Assuming "screencapture" is the name of the process you're trying to detect.)
Upvotes: 1
Reputation: 19682
the screensaver in Mac is just an application, so possibly you could check if the process is running...
I think the process is named 'ScreenSaverEngine', but I'm not sure if this is true for the version you have :)
Upvotes: 2