-
-
Save ruthenium/f829d243fa3b29cf798d to your computer and use it in GitHub Desktop.
This file contains 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 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