Open ghost opened 8 years ago
You're right it is a Firefox thing and unfortunately you can't do much about it.
The -no-remote
flag means the second profile isn't listening for messages from outside (e.g. "hey, you're already open, load this page"), so Firefox tries to start another instance, realises the profile's in use, and complains. Only one running instance can listen at a time (for… reasons, I don't really know why).
Tried to do this lately, @autrui ? :-)
@darktrojan, why's that? Nothing's changed for me from what I can see. If you found a workaround of some sort it doesn't show here. Still getting that error message. If I need to adjust some of the add-on's settings to make this work please let me know which ones. Thank you.
@darktrojan I've just tried this and it doesn't work.
Firefox profile2 has a "Open with" firefox item pointing to /usr/bin/firefox
.
When I try to open a link that I'd like to open in profile1(main profile) I get this error:
Firefox is already running but not responding. To open a new window you must first close the existing Firefox process, or restart your system
I've tried this on Archlinux with firefox 47.0.1
Please let me know if you know of a workaround for this issue !
@stefancocora Does your entry in Open With have the arguments -P profile1
? Open With goes looking in the profile for a file called openwith-socket
and tries to communicate through it.
@darktrojan I've just checked and the entry in profile2
contains only the FF binary path /usr/bin/firefox
How would I add the -P profile1
to the Open With entry. It doesn't seem to be a right-click option for adding arguments?
TL;DR: replace the firefox
command in Open With options... → <item> → Edit → Command...
with the wrapper below e.g. $HOME/bin/open-with-firefox.sh
. (Don't forget to chmod +x
it.)
Firefox options (e.g. -P <name>
) in Open With options... → <item> → Edit → Arguments...
work as expected. --new-tab
can be used, but isn't needed. Don't use --no-remote
or --new-instance
.
This post suggests that Firefox is controlled by environment variables which enable/disable remote control. In that case, MOZ_NO_REMOTE=1
was preventing a Firefox instance opening new tabs.
I added a new command to Open With which dumps out its environment and argument to a logfile:
#!/bin/sh
logfile="$HOME/logs/env.log"
date=$(date)
echo -e "--- $date [$@] ---\n" > $logfile
env | sort >> $logfile
The result (minus the MOZ_*
env vars already set in my shell):
MOZ_APP_RESTART=1
MOZ_LAUNCHED_CHILD=
MOZ_NEW_INSTANCE=1
No MOZ_NO_REMOTE
, but MOZ_NEW_INSTANCE=1
looks suspicious. Sure enough, executing a wrapper script which unsets it does the trick:
#!/bin/sh
unset MOZ_NEW_INSTANCE MOZ_NO_REMOTE
exec firefox "$@"
On my system (Arch Linux/Cinnamon), I launch Firefox via a menu/panel launcher whose command is:
firefox --ProfileManager --new-instance
The --new-instance
option results in the MOZ_NEW_INSTANCE
environment variable being set and exported to child processes. Ditto --no-remote
and MOZ_NO_REMOTE
. [1][2]
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=630548#c8 [2] https://dxr.mozilla.org/mozilla-beta/rev/64b8f9218c9894223a9ae02c43de6643bd97c98d/toolkit/xre/nsAppRunner.cpp#3460-3477
In order to run two firefox instances each with a separate profile, we have to use no-remote
to launch the non-default instance.
Is there a way to use Open-With to launch a link in that other profile? If not, is there a different way to run two profiles simultaneously and use Open-With to send links betweenst them?
@BGMcoder
In order to run two firefox instances each with a separate profile, we have to use no-remote to launch the non-default instance.
To launch a Firefox instance with a different profile, use -P <name>
.
Is there a way to use Open-With to launch a link in that other profile? If not, is there a different way to run two profiles simultaneously and use Open-With to send links betweenst them?
If you want to open links in another instance, don't open it with --no-remote. --no-remote
means "this instance does not accept remote commands" [1][2][3], which means it can't be instructed to open new links.
[1] https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#-no-remote [2] https://bugzilla.mozilla.org/show_bug.cgi?id=650078 [3] https://bugzilla.mozilla.org/show_bug.cgi?id=716110
Thank you! After experimenting around I realized that I was trying to use -no-remote
on both the default instance AND the second instance (I'm juggling three at the moment as I am building a new profile from an old one). I see that to open in the default instance, you don't use any arguments. The arguments are only necessary for the second or third instances. -----Just like you said, chocolateboy! Thanks!
I love this addon and am going to give it a 5-star review.
@chocolateboy Great news - unfortunately not for Mac user it seems. The environment variables mentioned don't turn up in the log dump in the first place. Any thoughts on how to make this work on a mac?
Thanks for your detailed reply @chocolateboy in https://github.com/darktrojan/openwith/issues/99#issuecomment-272665085 On my system running Archlinux/gnome3 with the default firefox installed, I open 2 instances like this:
The main firefox instance opened with the default firefox.desktop
launcher from /usr/share/applications/firefox.desktop
, no changes at all.
This instance is meant to be used as the main instance that will receive links with Open with.
Then I have a 2nd firefox instance with a custom .desktop
entry in a home directory, with an exec line that looks like this
firefox --new-instance --no-remote -P myprofile https://lwn.net/
This way of starting the 2 instances of firefox , with 2 separate profiles + @chocolateboy comment linked above makes it so that my 2nd instance of firefox can send links with the Open with
addon to the main firefox profile !
Great ! 👍 👍 👍
Maybe, it would be useful for someone: this line works fine for me on Windows.
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -profile C:\path\to\profile --new-instance --new-tab
Hi.
I have 2 Firefox profiles. When both are launched and I try to use your add-on to send a link from profile 1 to profile 2 I get an error message saying that Firefox is already running and that there can't be more than one instance running. I'm on OSX and I call the 2nd profile in your add-on with these arguments:
/Applications/Firefox.app/Contents/MacOS/firefox -P profilename -no-remote
I've toyed around with the
-no-remote
-part but I couldn't get it to work. It has to be a Firefox thing because I can send as many links as I want to Safari without any problem at all.Solving this would really make my life so much easier. Thanks for your help.