Skip to content

Instantly share code, notes, and snippets.

@ruthenium
Forked from ottoradke/Google Chrome Incognito
Last active August 29, 2015 14:20
Show Gist options
  • Save ruthenium/f829d243fa3b29cf798d to your computer and use it in GitHub Desktop.
Save ruthenium/f829d243fa3b29cf798d to your computer and use it in GitHub Desktop.
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
set chrome_running to is_running("Google Chrome")
if chrome_running then
tell application "Google Chrome"
repeat with w in (windows)
if mode of w is "incognito" then
set index of w to 1
tell application "System Events" to tell process "Google Chrome"
perform action "AXRaise" of window 1
end tell
activate
return
end if
end repeat
end tell
tell application "Google Chrome"
make new window with properties {mode:"incognito"}
activate
end tell
else
do shell script "open -a /Applications/Google\\ Chrome.app --args --incognito"
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment