Skip to content

Instantly share code, notes, and snippets.

@drikin
Created July 22, 2012 18:01
Show Gist options
  • Save drikin/3160519 to your computer and use it in GitHub Desktop.
Save drikin/3160519 to your computer and use it in GitHub Desktop.
Safari Sleeper
on getFront()
tell application "System Events"
set thisApp to name of first process whose frontmost is true
end tell
end getFront
on check()
if getFront() is not "Safari" then
try
do shell script "killall -STOP WebProcess"
do shell script "killall -STOP PluginProcess"
end try
else
try
do shell script "killall -CONT WebProcess"
do shell script "killall -CONT PluginProcess"
end try
end if
end check
repeat
check()
delay 1
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment