Created
July 22, 2012 18:01
-
-
Save drikin/3160519 to your computer and use it in GitHub Desktop.
Safari Sleeper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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