gcollazo/BrowserRefresh-Sublime

Browser Refresh not working on Chrome (Mac)

sebastianrb opened this issue · 16 comments

Hi,

I just downloaded Browser Refresh on Sublime Text 2 and it's not working when I have a doc open in Chrome. When I press command+shift+r it saves the file but does not switch to Chrome and refresh. Am using Chrome version 38.

I tried on Safari, however, and it worked fine. Any suggestions?

[Solved]

Same here.
"browser_name" : "all"
and
"browser_name" : "Google Chrome"
do not refresh Chrome v. 38.0.2125.111 for Mac (Maverics)

Safari works as expected.

What name should I use to enable Chrome refresh??

[Solved]

Parallels Desktop with Chrome Browser crashed your apple script.

Fixed by setting Chrome for Mac as default browser and back to non default + disabling launching Chrome from Paralles as default Chrome.

thx for the great script.

HTH

Don't quite understand this explanation..can you be more specific?

I don't know what Parallels Desktop is...

Ok, sorry man, thought PD was known to all.

Parallels Desktop is a VM application that let you run Windows OS and application seamlessly on Mac by way of virtualizing the physical machine (think Virtual Private Servers for hosting, but for desktop).
PD makes all Windows application available to run on Mac in a "native" feel, by installing compiled apple scripts in the Mac Application directory that when launched essentially start the virtual machine and summon the Windows application.

I ran your apple script in the Mac Script Editor and noticed it could not "tell application "Google Chrome" activate" because there were 2 on my machine, one from Mac and one form PD.

I then fixed the uncertainty as I described (sorry if I was vague) and launched the Apple Script form the Editor to test if it worked and it did.

The same script naturally now runs fine form within Sublime.

Hope I was clear this time.

Again, great idea to use AS!! Genius!! Thx for the plugin!

Yes, that explanation was clear.

Issue is I'm a bit of a newbie and don't know how to execute the second part of this solution:
"Fixed by setting Chrome for Mac as default browser and back to non default + disbling auto load fo chrome from Paralles."

Not really your problem, like I said I'm new to this stuff so it's tough for me to fix technical issues...but if anyone can explain the solution process with some detail I'd be very grateful.

Thanks again for your help!

chrome://settings/ "Make Google the default browser" (is the last setting in the standard view)

Then in PD settings Parallels Desktop->Virtual Machine->Options->Applications: Web Pages-> Open in Mac

run your script

then reverted chrome://settings/ "Make Google the default browser"
and left PD setting to always open in Mac

Don't ask WHY it worked, I tried randomly :0

Maybe people that cannot get the expected behavior in Chrome for Mac should try and run the script from the editor as I did and see what errors they get... I guess every Mac is different, so it's best to run the script natively to check it's not a configuration problem of the specific machine.

I guess it would be cool to have the whole browser document (i.e. all open tabs in a window) to refresh, since now a days a lot of people are using Chrome agent simulator to test for different screen sizes and have their browser open on all sizes all together to test for responsiveness (Bootstrap anyone?).

So if you have time you might upgrade the script to refresh the whole browser, instead of just the active tab. Also AS lets you query the URL that is open in a browser, so you might want to add URL specific refresh, so people can refresh just the tabs that point to their site of interest.

Not a big deal though.

Cheers,
M

I actually don't even have PD installed on my comp, so it must be some other issue. Thanks anyway man, appreciate the help!

Can you run the script outside of Sublime?
That will tell you aver the problem is

The same thing happens in Ubuntu (sublime 2; Google Chrome; Ubuntu x64).
It does change to the chrome window, but it doesn't reload it. It's like the F5 key isn't sent.

The "solution" with Parallels is no actual solution but a workaround. Imho it's not even a good work workaround as it will increase the load on your system by a fair amount.

(Maybe the title should change to reflect that this happens on other OSes as well?)

On Linux the issues lies upstream:

https://code.google.com/p/chromium/issues/detail?id=393145

They mention that chrome doesn't "listen" to xdotool command anymore. This seems to be the case.

xdotool search --sync --onlyvisible --class google-chrome key F5
and
xdotool search --sync --onlyvisible --class google-chrome key ctrl+r
both fired from the commandline don't trigger a response in chrome.

Both commands work as expected when swapping google-chrome by firefox.


EDIT: upon further reading I managed to trigger a page reload by using:
xdotool search --sync --onlyvisible --class google-chrome windowfocus key F5

Notice the added windowfocus before key.

I can also confirm that chrome starts acting as expected when you change

cmd = ['xdotool', 'search', '--sync', '--onlyvisible', '--class', cls, 'key', key]
to
cmd = ['xdotool', 'search', '--sync', '--onlyvisible', '--class', cls, 'windowfocus', 'key', key]
on line 40 of Browser Refresh/linux/__init__.py

I shall put in a pull request for it.

woutervddn,
Looks like also a "scripting" issue on Ubuntu.
This small tool is very handy, but I guess a more professional solution is Emmet.

In my case this tool was all I needed for a small project.
I am trying out Emmet for my next hoby project.

Anyway thx for the clarification, but I am afraid I was not clear. I run PD for Autocad, not for Sublime. I do Sublime+Chrome native on Mac

Cheers

I just ran into this same issue on linux mint - has this fix been released? I just manually updated my packages to get it working.

The issue still persist with Sublime2 + Chrome + windows 7. Does not refresh the browser

I just ran into this issue again - three years later - finding my own comments. @gcollazo any chance you could release an update?

@Rio517 I don't have the time to maintain this repo. I'm looking for a new maintainer to take over. Interested?