First of all, sorry for my english, not a native speaker.
Since I'm a bit fed up opening Termninal and ^C
I want to create a shortcut for activating caffeinate -d
on my Mac OS X 10.11
I've been trying a simple Automator Service but with my noob skills it doesn't work.
This is the settings:
I chose Service as type of document
Library->Utilities->Run Shell Script
Service receives: no input
in: any application
Shell: /bin/bash
Pass input: to stdin
CAFFEINATECHECK=`ps | grep caffeinate | cut -d ' ' -f7,8`
if [ $CAFFEINATECHECK == 'caffeinate -d' ]; then
killall caffeinate
else
caffeinate -d
fi
Problem is that such a short scrip keeps running with no response and I have to stop it after a minute
I hope someone could give me any tips necessary