Last active
September 25, 2022 16:20
-
-
Save blood72/02fa3317a8c9198f93cff983b39bd325 to your computer and use it in GitHub Desktop.
Open Vivaldi Browser on private mode for Choosy (applescript)
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 open location this_URL | |
set _NOT_ACTIVATED to 0 | |
if application "Vivaldi" is running then | |
# open previous browser | |
tell application "Vivaldi" | |
set totalWindows to count of window | |
set currentWindow to 1 | |
set selectedWindow to _NOT_ACTIVATED | |
# find specified mode | |
repeat totalWindows times | |
if (mode of window currentWindow) as text = "incognito" then | |
set selectedWindow to currentWindow | |
end if | |
set currentWindow to currentWindow + 1 | |
end repeat | |
if selectedWindow is not _NOT_ACTIVATED then | |
# open to previous window | |
tell window selectedWindow | |
make new tab with properties {URL:this_URL} | |
end tell | |
else | |
# open to new window | |
make tab with properties {URL:this_URL} at (make window with properties {mode:"incognito"}) | |
close tab 1 of front window # close empty tab | |
end if | |
end tell | |
else | |
# open new browser | |
do shell script "open -a /Applications/Vivaldi.app --args --incognito " & this_URL | |
end if | |
# browser focus | |
tell application "Vivaldi" | |
activate | |
end tell | |
end open location |
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 open location this_URL | |
set _NOT_ACTIVATED to 0 | |
if application "Vivaldi" is running then | |
# open previous browser | |
tell application "Vivaldi" | |
set totalWindows to count of window | |
set currentWindow to 1 | |
set selectedWindow to _NOT_ACTIVATED | |
# find specified mode | |
repeat totalWindows times | |
if (mode of window currentWindow) as text ≠ "incognito" then | |
set selectedWindow to currentWindow | |
end if | |
set currentWindow to currentWindow + 1 | |
end repeat | |
if selectedWindow is not _NOT_ACTIVATED then | |
# open to previous window | |
tell window selectedWindow | |
make new tab with properties {URL:this_URL} | |
end tell | |
else | |
# open to new window | |
make tab with properties {URL:this_URL} at (make window) | |
close tab 1 of front window # close empty tab | |
end if | |
end tell | |
else | |
# open new browser | |
do shell script "open -a /Applications/Vivaldi.app --args " & this_URL | |
end if | |
# browser focus | |
tell application "Vivaldi" | |
activate | |
end tell | |
end open location |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment