Opening a link doesn't re-use existing app instance on Linux
codemedic opened this issue ยท 11 comments
Is your feature request related to a problem? Please describe.
Sometimes when clicking on a link, browsers
can popup but can end up not clicked on. This can leave the app running till its clicked on. I found them all hanging around while closing down all apps before shutting down my laptop.
Describe the solution you'd like
A timeout for selection of browser can resolve this. A visual feedback would be nice to make the user aware of the popup's impending closure.
Describe alternatives you've considered
You could make browsers
open only once, there by only one of them will ever keep running.
Additional context
N/A
I realised that they got left behind since I wrongly assumed that the window would disappear when I click away from it. Perhaps adding a close button would remove that confusion. Having a timeout as well would provide a "catch all" for this problem.
Oh, did not know this happens in linux. Thanks for reporting.
I don't see a need to have more than one present, so the solution would involve re-using the existing instance.
(Some in depth details: in macOS opening an url triggers an event instead of opening application directly, so the existing instance handles the event if already running, that's why I didn't notice the issue in macOS)
Note that orphaned windows can occur in macOS as well (macOS 12.6.3).
I wanted to find the Browsers website. So I invoked the pallet, clicked the three vertical dots, and selected "About". I found the web address. And as I'm typing this the pallet it still there. I can easily hide it behind another app and forget about it.
Clicking another link and then selecting a browser for the list will invoke a new pallet, dismissing the 'orphaned' one. Thus it seems there could be at most but one orphan pallet it seems.
And clicking escape while the pallet is front most will dismiss it.
@liias You might want to try D-Bus, with a unique bus name for your application. When the application starts, try to acquire the bus name. If another instance is already running, this will fail, and you can communicate with the running instance to open a URL. (at least that is my understanding of Linux GUI; never tried myself).
Note that orphaned windows can occur in macOS as well (macOS 12.6.3).
I wanted to find the Browsers website. So I invoked the pallet, clicked the three vertical dots, and selected "About". I found the web address. And as I'm typing this the pallet it still there. I can easily hide it behind another app and forget about it.
Clicking another link and then selecting a browser for the list will invoke a new pallet, dismissing the 'orphaned' one. Thus it seems there could be at most but one orphan pallet it seems.
And clicking escape while the pallet is front most will dismiss it.
To clarify, this is a little bit different. Just one instance can still exist at a time (unless there's a bug). It sticks around when you click on something else, because I found the behaviour a little too inconsistent between mac and linux and sometimes it's a bit annoying if it disappears when you just want to check something from another app and then come back and choose where to open the link in.
I think one good solution could be closing it with a delay though, so it exits after 1 minute or so. But then again, even if it's open somewhere in the background, it shouldn't be too bad of an issue as long as there exists only 1 instance.
@liias You might want to try D-Bus, with a unique bus name for your application. When the application starts, try to acquire the bus name. If another instance is already running, this will fail, and you can communicate with the running instance to open a URL. (at least that is my understanding of Linux GUI; never tried myself).
Thanks for the hint, will take a look after my vacation in a few weeks
"To clarify, this is a little bit different. ..."
Yep. I don't know if you saw my comment on issue #10, where I note that the Browsers pallet is appearing in space other than the active one (and thus appearing as if it was not working). I looked at this issue to see if they might be related, but as I discovered, the orphaned instance on macOS disappears when a new instance is invoked. And in my testing did not lead to the opening in a different space issue.
Anyways, thanks again for the replies, and enjoy your vacation.
I digged into how to solve this. It's not going to be straight-forward fix, so it will take some time (specially for inter-process communication to pass new url to existing instance). But I found some promising rust crates, which hopefully solve it for all 3 operating systems.
This is fixed now since 0.2.9, let me know if there are any issues.
There is only one instance and clicking another link will re-use previous instance if it's still open.
That's great! Thanks @liias
It seems to have introduced a slight misbehaviour though.
Usually when I click on a link, the popup appears above the window I clicked on, but if there is an existing Browsers window it doesn't pop itself above the window I clicked on.
Hey, @codemedic. This should be fixed now in 0.3.5 (should be released in 15 minutes or so).