Created
April 17, 2012 16:26
-
-
Save jaredhabeck/2407307 to your computer and use it in GitHub Desktop.
osascript to reload chrome or firefox, make reloadbrowser.sh available to watchr via PATH or otherwise...
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
#!/usr/bin/osascript | |
-- setting to return focus to the initial calling app (in my case it's Textmate) | |
set callingApp to (path to frontmost application as Unicode text) | |
-- tell application "Google Chrome" | |
-- activate | |
-- end tell | |
-- | |
-- tell application "System Events" | |
-- tell process "Google Chrome" | |
-- keystroke "r" using {command down} | |
-- end tell | |
-- end tell | |
tell application "Firefox" | |
activate | |
end tell | |
tell application "System Events" | |
tell process "Firefox" | |
keystroke "r" using {command down} | |
delay 0.1 | |
end tell | |
end tell | |
-- return focus to calling app | |
tell application callingApp | |
activate | |
end tell |
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
# to be placed in a rails project at the top level, then run: | |
# watchr script.file | |
# regex is a bit too greedy I think... | |
# this also assumes the reloadbrowser script is in your PATH (mine is in /usr/local/bin) | |
watch( 'app/(.*/.*)(\.js|\.scss|\.haml)' ) {|md| system("reloadbrowser") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment