I'm using Firefox on Linux and 2 is how it's been working for me for a looong time now. Clicked links in external programs always open in the last active Firefox window for me. Is this OS or even window-manager specific?
I think they mean they have windows open in different profiles (profiles, not containers), and want the last active one to pick up links from external apps...
I, for one, would like the last active container to be used.
Interesting. I like the option which Edge gives, which is I select the profile that gets URL opens from outside the browser (my "main work profile") and add site-level exceptions that route certain sites to the right profiles (example: LinkedIn links should open in my personal profile, Demo Server accounts open in the dedicated demo profile).
If I relied on "last active" I would frequently get things opening up in the wrong place just because say, last time I was in a browser I happened to be in a my personal profile, and 30 minutes later, I click a link in work Slack.
Yeah, I can see how that can end up messy, but filtering by url also doesn't always work. To give one example: I may open google docs in different containers because I have several accounts (personal and work). So, if I receive a link to a doc that was shared to me, and open it from the mail client... it won't necessarily end up in the right container. It can end up working fine when you use the menu to open in another container, but on many sites, the original url is redirected to a login page or whatever and opening in another container is not going to be helpful at all because you've now lost the original link you needed to open.
Are you using different profiles ? I have two running at the same time, links always open in the browser instance running the "default" profile, not the other one.
i also have two profiles. i noticed that for me links open in the profile that was started last. in my case i always want them to open in the default profile, so i have to make sure to start the other profile first, and default second.
this may not be easy to fix.
the problem here is how the url opener selects the process.
at that point it can't even know which process has the last active window. it would have to connect to both processes and request that information instead of just sending the url to the most recent process in the list. and then each process would have to return when it was last active to be able to choose which one of these was active more recently. this may not be possible without some more elaborate book-keeping of timestamps when a window gets activated.
this increases the complexity of the url opening feature in a non-trivial way.
it may not even be desirable to handle this in firefox only.
what if you run chromium and firefox? now you want a generic url opener that sends the url to the last active browser.
what we really want here is to have a generic way to send an url to an open window.
> at that point it can't even know which process has the last active window. it would have to connect to both processes
Forgive me as I'm not a "real" desktop programmer, only web technologies really, but...
Is there not some master process that knows the basic details about its various separate processes? I mean, the main process has to be able to tell the others to quit, right? I would have thought it could keep track of the metadata of each for coordination purposes, like, as a process's window becomes Front it could check in and say 'yo this is process 12345, I'm profile X and I'm becoming Active.'
i don't know how wayland does it, but one of the challenges in X11 was that it was not trivial or even possible to relate an X11 window to its unix process because the window could be coming from a remote machine. in other words X11 knows nothing about unix processes.
kill in X11 is done by sending a message to the window to go away. in the normal case this triggers an exit in the process, but it is possible for the process to keep running or even open a new window. X11 can not force a program to really terminate because again the process could be from a different machine or a different user.
there are two ways to talk to a process: one is to find the X11 window and send messages to it through the X11 protocol. this is done for example to share clipboard contents. it would be possible to send urls that way too.
the other is to find the unix process, and use some rpc mechanism to talk to it that way.
as far as i can tell, firefox is using the unix process. this may be because of the cross platform nature of firefox. process RPC is easier to do in a cross platform way. the X11 method does not work on windows or MacOS, so that would mean that each system needs custom code to handle this.
I got tired of dealing with it and just told my system that URLs should be opened by a script I wrote that just puts the URL in the clipboard and shows a notification that it did so. So I open/click a link, then go find the window I want it to open in and paste and go.