gcollazo/BrowserRefresh-Sublime

Support for Firefox Developer Edition

AlexKvazos opened this issue · 17 comments

Are there any plans to add support for Firefox Developer Edition?

Thanks,
Alex

@AlexKvazos Pull requests are welcomed. Currently I'm not using FF DevEd so I don't really have a need for it.

If you are interested I can point you in the right direction on how to implement this feature 😄

Sure! I'd be glad to help integrate this. What should I have a look at to get an idea of what I have to add?

I just stumbled on this issue as well, glad to help as long as I know what to do.

@waldbach This are the basic things that need to be donde to support a new browser. I'm assuming you are on a Mac.

First you have to create a regex to detect if the browser is running https://github.com/gcollazo/BrowserRefresh-Sublime/blob/master/mac/utils.py

Then make an AppleScript that will actually refresh the browser
https://github.com/gcollazo/BrowserRefresh-Sublime/blob/master/mac/__init__.py

Finally hook everything up in the main plugin file and make sure you test different settings
https://github.com/gcollazo/BrowserRefresh-Sublime/blob/master/BrowserRefresh.py

Thanks, I fiddled with those locally, yesterday. But I guess I could not get the naming right for the Developer Edition. I will try again, cheers!

That should be the regex for the search.

if re.search('FirefoxDeveloperEdition\.app', ps) is not None:
    running_browsers.append('firefoxdeved')

Ah, that's very close to what I had yesterday. Will try this, thanks!

This should be the AppleScript. If it doesn't work you should try adding a delay 0.1 after the activate instruction.

tell application "FirefoxDeveloperEdition"
    activate
    tell application "System Events" to keystroke "r" using command down
end tell

For the Applescript I had this:

   def firefoxdeved(self):
        command = """
            tell application "FirefoxDeveloperEdition"
                activate
                tell application "System Events" to keystroke "r" using command down
            end tell
            """

        if 'firefoxdeved' in self.browsers:
            self._call_applescript(command)

Not working, yet...

In BrowserRefresh.py I have the following:

        elif browser_name == 'FirefoxDeveloperEdition':
            refresher.firefoxdeved()

and

        elif browser_name == 'all':
            refresher.chrome()
            refresher.safari()
            refresher.firefox()
            refresher.opera()
            refresher.firefoxdeved()

Also in utils.py I have

    if re.search(b'FirefoxDeveloperEdition\.app', ps) is not None:
        running_browsers.append('firefoxdeved')

not the b before 'FirefoxDevel...
I tried with and without. Close, but no cigar, yet.

In __init__.py I have the following now:

    def firefoxdeved(self):
        command = """
            tell application "FirefoxDeveloperEdition"
                activate
                delay 0.1
                tell application "System Events" to keystroke "r" using command down
            end tell
            """

        if 'firefoxdeved' in self.browsers:
            self._call_applescript(command)

My apologies for the struggle here, I know little to none about Python.

That commit adds the feature. I'll try to release a new version as soon as possible.

Fantastic. Thanks a lot, Giovanni!

There seems to be a bug where Safari starts up when it's not running on refresh. Firefox Dev Ed is refreshing after that.
For now I commented out Safari, since I don't use that for testing.

In BrowserRefresh.py I commented out:

        elif browser_name == 'all':
            refresher.chrome()
           # refresher.safari()
            refresher.firefox()
            refresher.opera()

Now it all works fine! :)

Edit: I just realized this is better posted as a new issue, will do that now.