Page 1 of 1

How to use SeaMonkey with other profile as protocol handler?

Posted: Sun Sep 28, 2014 6:44 pm
by barbaz
Just switched email client from Thunderbird 2 to SeaMonkey (on Mac OS X), and I need to use separate profiles for browser and email. So I start SeaMonkey mail profile from a shell script with "-no-remote -new-instance".
Part of keeping browser and email profiles separate is that links from emails will need to be opened in the browser profile, creating a new SeaMonkey instance if needed.
I got part way there by disabling mail phishing protection and setting SeaMonkey.app as the external handler for http(s) links, but that opens a stray browser window in the mail profile, and it only works correctly if the first started instance of SeaMonkey is the browser profile (which it won't always be).

So how to always open http(s) links in SeaMonkey with a different profile, no matter what instances are started when?
(If no one here knows, would I be better off to ask on mozillaZine or IRC?)

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Tue Sep 30, 2014 4:13 am
by Thrawn
Sorry, no idea. I haven't used Seamonkey to speak of.

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Wed Oct 01, 2014 6:15 pm
by barbaz
(Where's therube? If anyone here knows either the answer or where I would be better off to ask, I'd think he would.)

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Wed Oct 01, 2014 7:31 pm
by therube
The only "better" place is where you happen to get an answer ;-).

All are good - if someone is around who knows what to suggest.

I'd start with mozillazine, get something written up there.
Then jump to #seamonkey & ask there, pointing to mozillazine if necessary, for further detail or to see existing responses. (It's all going to depend on who's around & who might know.)

I know there have been network network.protocol-handler.external.http suggestions before (by myself, at least) for someone to try, but I don't think anyone's actually responded back as to how or if it worked out.

No sure of the specifics of -new-instance offhand (or even -no-remote, even though I use it regularly).

Seem to recall a report or bug about a blank (SeaMonkey ?) window, perhaps relating to a similar situation.

To be clear, Mail is with -no-remote, & you would otherwise have no other instance of SeaMonkey, or an instance opened without the -no-remote switch. And a link from Mail is also intended to open a Profile, again without a -no-remote switch (as I think that's the only way it would work in any case).


As far as Mail itself, there are a number of issues that cropped up with 2.29.1 that were not in 2.26, just so you know. Likewise some have reverted or are not yet updating to 2.29.1 waiting for those issue to be resolved (with later release).


I'd mess around with this a bit, but at present time is not on my side.
(posting now so i don't loose what i've put down, but may update, some, ... later?)

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Wed Oct 01, 2014 9:02 pm
by barbaz
Thanks therube for answering.
Will try mozillaZine later today.
therube wrote:Seem to recall a report or bug about a blank (SeaMonkey ?) window, perhaps relating to a similar situation.
I'm pretty sure it's not a "bug". It is, however, a nuisance.
therube wrote:To be clear, Mail is with -no-remote, & you would otherwise have no other instance of SeaMonkey, or an instance opened without the -no-remote switch. And a link from Mail is also intended to open a Profile, again without a -no-remote switch (as I think that's the only way it would work in any case).
Yes.
therube wrote:As far as Mail itself, there are a number of issues that cropped up with 2.29.1 that were not in 2.26, just so you know. Likewise some have reverted or are not yet updating to 2.29.1 waiting for those issue to be resolved (with later release).
Unfortunately, due to some of the extensions I need, I'm forced to use at least Gecko 30 aka SeaMonkey 2.27a2, so reverting to 2.26.1 isn't an option here.
I did see that 2.29.1 can't import bookmarks from a .json file and it corrupts offline IMAP storage, but I don't think I care atm as I don't store IMAP messages offline and there are quite a few copies of my places.sqlite lying around this computer. Were there any other issues?
If not, or if the other issues don't affect me either, my plan is to stick with 2.29.x until the next major Gecko release, then depending on what the release notes for the next SeaMonkey release say, either self build 2.30, or try to upgrade to a custom build of 2.28 from comm-esr31 since that's where it seems the mailnews fixes are going.
(Don't want anything to do with any of that HTML5 DRM crap. Especially Don't want it in my mail client!!)

(edited to fix typo)

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Wed Oct 01, 2014 9:05 pm
by barbaz
therube wrote:I know there have been network network.protocol-handler.external.http suggestions before (by myself, at least) for someone to try, but I don't think anyone's actually responded back as to how or if it worked out.
It only worked if I started the browser profile *before* the mail profile, but also I ran into a weird issue with this where some links which should normally be opened in the background were getting opened in a browser window asking about the external handler (how else could I explain the spontaneous pop-up browser windows in a profile that blocks everything and I'm sure doesn't have malware?)...

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Wed Oct 01, 2014 11:03 pm
by barbaz
therube wrote:I'd start with mozillazine, get something written up there.
http://forums.mozillazine.org/viewtopic ... &t=2875763

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Thu Oct 02, 2014 2:51 pm
by therube

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Sun Oct 05, 2014 4:43 pm
by barbaz
Well, seems no one's answering at mozillaZine, even though people have been around... that's even after I posted this:
After looking into this further, I've concluded that the best approach here is likely going to be to write an extension that intercepts top-level loads in the browser and passes specified kinds of URLs to a specified external application instead of letting them load. However, I have no idea how to invoke SeaMonkey from the extension. If I try to run SeaMonkey (even with -remote "openURL(...)" ) from a terminal or shell script, and if there is already a SeaMonkey instance with the browser profile running, it just aborts with an alert box saying there's already a running SeaMonkey instance.

How can I invoke SeaMonkey from an extension to achieve what I want, if that's possible?
Any ideas about that ^^ ? Should I wait more @ mozillaZine (if so, how long?), or just ask at IRC at this point?

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Mon Oct 06, 2014 2:19 pm
by therube
> or just ask at IRC at this point?

Sure, go ahead.
I actually thought you were going to do that (or had) once you put up the initial post on mozillazine.

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Sat Oct 11, 2014 8:24 pm
by barbaz
Solved!

Install a second copy of SeaMonkey as /Applications/SeaMonkey2.app, then start Mail with the following shell script:

Code: Select all

#!/bin/ksh
/Applications/SeaMonkey2.app/Contents/MacOS/seamonkey -no-remote -new-instance -P mail
Now set /Applications/SeaMonkey.app as the external handler for http(s) links

That's it!

Thanks to mcsmurf and Mc for the suggestions.

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Sun Oct 12, 2014 12:56 pm
by therube
(I'll have to read through #seamonkey when I've got time to think. I answered a question on mozillazine that I linked here, maybe I should have linked this to there too. I will, but perhaps not till tomorrow or so.)

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Sun Oct 12, 2014 4:26 pm
by barbaz
(FWIW I posted the solution in my mozillaZine thread as well, if you would rather link that.)

Re: How to use SeaMonkey with other profile as protocol hand

Posted: Fri Aug 28, 2015 6:03 pm
by barbaz
So I've just tried to do this in Linux & the solution that worked for Mac wasn't working & I couldn't figure out why. After some discussion with NeilAway & therube on IRC, we discovered that the -no-remote & -new-instance command line options are respectively setting the MOZ_NO_REMOTE & MOZ_NEW_INSTANCE environment variables on the seamonkey-mail process & all its child processes, thus causing the invocation of the separate SeaMonkey browser to think it has to run as its own sole instance & rejecting other attempts to run or call it.

So to make this work on Linux it's needed to have a wrapper for seamonkey browser that unsets those variables. This ksh script, placed in the same directory as the seamonkey browser binary, seems to work:

Code: Select all

#!/bin/ksh
unset MOZ_NO_REMOTE
unset MOZ_NEW_INSTANCE
"$(dirname $0)/seamonkey" $@
Make it executable & set it as the http & https handler in seamonkey-mail, & at that point it was working for me.


And another tip I discovered along the way, here's how to determine environment variables from SeaMonkey:
Tools > Web Development > Error Console
Type/paste the following:

Code: Select all

Components.classes['@mozilla.org/process/environment;1'].getService(Components.interfaces.nsIEnvironment)
followed by either
  • .get('VAR') to obtain the value of environment variable VAR
  • .exists('VAR') to see if the environment variable VAR is set