Skip to content

Instantly share code, notes, and snippets.

@zetavg
Created November 25, 2022 09:00
Show Gist options
  • Save zetavg/06da03ebfe394fd1730398feb5271051 to your computer and use it in GitHub Desktop.
Save zetavg/06da03ebfe394fd1730398feb5271051 to your computer and use it in GitHub Desktop.
Bind this script to a hot key that runs if the active app is Arc. (e.g. BTT)
-- Can change this to your favorite new tab page extension URL, such as "chrome-extension://laookkfknpbbblfpciffpaejjkokdgca/dashboard.html"
set newTabPage to "chrome://new-tab-page/"
tell application "/Applications/Arc.app"
activate
-- tell front window to make new tab at after (get active tab) with properties {URL:"chrome://new-tab-page/"} -- not working
open location newTabPage
repeat
set windowTitle to ""
tell application "System Events"
set frontApp to first application process whose frontmost is true
set frontAppName to name of frontApp
set windowTitle to "no window"
tell process frontAppName
if exists (1st window whose value of attribute "AXMain" is true) then
tell (1st window whose value of attribute "AXMain" is true)
set windowTitle to value of attribute "AXTitle"
end tell
end if
end tell
end tell
if (windowTitle = "New Tab") then exit repeat
end repeat
tell application "System Events" to keystroke "o" using command down
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment