Closed BGMcoder closed 7 years ago
currently, BrowserSelect cannot differentiate different profiles. unless you have two different executable files (e.g. each profile is a different version of firefox) I don't think it can be done.
however, we can add such functionality, how would you prefer it to work ?
Some time back I used a program called BrowserTraySwitch which is similar to your BrowserSelect. The authour told me there was next to no way of working with multiple instances for Firefox, so I stopped using it.
It's true - the problem is that the executable is the same.
But here is my idea. When you launch the first instance, you normally don't use any special commandline parameters, but the second instance, if you want them simultaneously existing, must be launched with -no-remote -P MyProfileName
. I also use SystemExplorer which shows me what commandline parameters were used to launch an executable, and I can see those parameters in my second instance of Firefox. So, maaaaaaybbeeeeee you could track the launch of firefox executables and fetch their commandline parameters - you'd get the profile name from the parameters and have some way of telling the instances apart. I'm not sure how SystemExplorer knows the commandline parameters though - whether through monitoring or some other method.
In the end, you'd just show more firefox icons in the GUI, each with the profile name.
inspecting the running processes and creating multiple options based on that seems hard, also I prefer to keep BrowserSelect as Generic as possible , I don't like to put a firefox-specific or chrome-specific functionality in it. right now any browser that can be set as default in windows can be used with browser select.
however, we may be able to add a section to settings that allow duplicating browsers with extra flags, e.g. chrome --incognito
or chrome --proxy-server="socks5://myproxy:8080"
as an option. this way you can make options for your profiles yet not much needs to be changed.
in the last version I've already added sending flags to browsers (when Shift-clicking them to open in private/incognito mode). would something like this be acceptable ?
Well, I can understand not wanting to make things for specific browsers. I don't think this is going to work unless you do that, however.
Do you mean that you have to use BrowserSelect to launch the browser?
I don't know that you can send a flag (commandline parameter?) to a running Firefox. Maybe I don't understand you.
Another idea is to use one of Firefox's titlebar-changing extensions, then you can choose between program (or even window) instances based on the titlebar text. Right now I'm using Firetitle.
I don't personally use firefox profiles so, I don't know exactly how you envisioned it, but the bottom line is that browserSelect launches an exe file with some parameters.
you said BrowserSelect can determine these parameters by inspecting running processes and their command line , I suggested that these command lines (e.g. -P "profile_X"
) can be added via the settings menu as a new option in BrowserSelect's main window. so you could determine how to launch a link in the desired instance via cmd, then add a new Firefox inside browser select that sends some extra custom flags when giving the URL to Firefox.
these extra flags would be given to BrowserSelect in settings window and stored in the configuration file.
This would work, but then you would have to use BrowserSelect to actually launch the instance, which, in my estimation changes the scope of the program. BrowserSelect should only set the default for the urls; you should still be able to run the program any way you are used to and that BrowserSelect should be able to operate on already-running instances.
You see, the parameters for making firefox run in a second instance can only be used once when the application is launched. If you run that again it will try and open firefox again and you'll get a notice from firefox saying, "Firefox is already running, but is not responding. The old Firefox process must be closed to open a new window." - and you don't want to cause this. This won't work the right way for BrowserSelect. The parameters are only for launching a new instance. It might let you fetch a PID for the new instance if BrowserSelect actually launches it, but then you'd have to use that PID as the program handle later.
I don't really understand how I should open a new tab in an existing instance of firefox without running it again, currently , every time you click on a browser, BrowserSelect launches the browser's .exe file and lets it handle looking for an existing instance and contacting it to open a new tab.(except for IE)
my understanding was that firefox uses the -P
flag to contact the correct instance based on the profile or run a new one if one is not available. but it seems that is not the case...
should I implant something similar to the IE code? also if I understand correctly when you run a firefox instance with --no-remote
flag, no other process can contact it to open a new tab, which means even if i write code to find the launch time command line parameters and display firefox multiple times for each profile, there is no way to actually open a tab in that instance.
the only thing i found on the net was the -new-instance
flag, which although fails to open the url in a new tab, makes sure it is open in the desired profile, not the current instance.
Oh, I'm not talking about multiple tabs at all. The -P means to select an existing profile from the list of possible profiles contained in Firefox's profiles.ini file. The --no-remote parameter allows Firefox to open another instance of Firefox - that is, it starts another Firefox process. If you don't use that parameter then the executable tries to open the profile (if you used -P) in the current process.
For BrowserSelect, in my opinion, to work correctly for multiple firefox instances, it has to be able to distinguish between possible running firefox processes. You don't want to send commandline parameters because they only start processes (as far as I understand). To distinguish between the instances you can either fetch the parameters used to start the process from the running process's information (if that is possible) or using custom text in the titlebar.
For IE, I don't know if you can start multiple processes or not.
What I can say is that there is no program out there that has this functionality. There are some, that let you choose the default browser, but none of them work with multiple instances.
I see, but I still have no idea how to communicate with the running instances.
let's assume that I inspected the list of processes and read their command line. then displayed the appropriate number of firefox Icons on the main window.
what should happen when the user clicked on one? since you don't want me to send command line arguments (i.e. launch a new process). how should i communicate/send the URL to the running instance?
Ah, I see what you mean now. I can't think of anything short of pasting the url into the browser bar.... :( You got me on that one.
sending keystrokes is not really something I would like to implant into BrowserSelect, however, that can be easily implanted using AHK. it wouldn't be more than 10 lines of AHK to bring to front a window based on the title than paste something and press enter.
you can then compile the ahk into a .exe file and register that as a browser to BrowserSelect. that's probably not exactly what you had in mind but what you want can be achieved this way.
if there was a way to connect to firefox and send the url to it, even through COM or a socket i might've consider it but sending keystrokes is more of a hack than a solution.
haha, yeah, that would work. Not what I had in mind, no. Thanks anyway for considering.
Every day I run two instances of Firefox, each with a separate profile. Whichever instance I start first becomes the default browser. But sometimes I want certain links to always open in the other instance. Is there any way to manage that with BrowserSelect?