Created
September 24, 2022 15:48
-
-
Save gurgeous/1750c02e945fe222fa703694822fcfac to your computer and use it in GitHub Desktop.
reload a chrome tab when a file changes
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
# | |
# Reload localhost tabs. Sample usage: | |
# | |
# $ brew install watchexec | |
# $ watchexec --watch <DIRNAME> reload.osa | |
# | |
tell application "Google Chrome" | |
set window_list to every window | |
repeat with the_window in window_list | |
set tab_list to every tab in the_window | |
repeat with the_tab in tab_list | |
if (URL of the_tab contains "localhost") then | |
tell the_tab to reload | |
end if | |
end repeat | |
end repeat | |
end tell | |
set t to (time string of (current date)) | |
copy (t & ": reloaded") to stdout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment