GNOME Bugzilla – Bug 707451
first non-headless instance always opens an additional window
Last modified: 2013-09-20 10:26:02 UTC
1. killall epiphany 2. epiphany --headless-mode (as would be run when used as a search provider; keep this running in the background) 3. epiphany -> you get all your previous windows back plus an additional new one You can repeat these 3 steps over and over again and each time you'll get one additional window.
I think this is related to the fact that when you invoke ephy, and it's already running (even in the current stable), you'll get a new additional window. I don't know now whether this was intended or not, but I suspect it is not.
So that comes from this commit: commit b7f88ee85c61fee4f8059e7fc2456c3ca83ccb64 Author: Gustavo Noronha Silva <gns@gnome.org> Date: Mon Dec 10 18:13:27 2012 +0100 Open new windows when called with no URIs to open GNOME Shell tries to open new windows by calling the application with no parameters. This strategy is also used by the 'Launch web browser' keybinding, that can be interpreted as the user requesting a new window, so open a new window when called with no URIs, unless --new-tag is given explicitly. Partially fixes https://bugzilla.gnome.org/show_bug.cgi?id=685976 To add to the complexity, we now need to make sure that if there are no windows already open (that is, we are in headless mode), we shouldn't create a new one when opening with no uris...
Yeah, it was intended, but we didn't have the headless mode then. I haven't researched the headless mode yet, but should it really start the dbus session and stuff? Maybe it should be run in a way that is similar to the netbank mode (as in, use the existing profile read-only) but without interfering with the regular instances?
OK, I see now that my comment makes no sense - we need it precisely to be a dbus service. I guess we just need to tweak the open uris code to check if there are no existing windows, then, like you said. Will take a look at this, hopefully tonight, otherwise early next week!
*** Bug 707615 has been marked as a duplicate of this bug. ***
Created attachment 254384 [details] [review] Add a new startup flag to indicate we are resuming a session Web should open a new window if no URIs are passed - it's how GNOME Shell does its 'new window' magic. However, it should not do so if the instance that is already running is a headless instance that happens to be active, and resumes a session when called with or without URIs.
Turns out checking for 'no windows' is no good, because we *do* have windows when we get to that code path - the session has already resumed. However, that gives us just what we need - the fact that we resumed a session is a clear indication that we should not open a new window.
Created attachment 255073 [details] [review] Add a new startup flag to indicate we are resuming a session Web should open a new window if no URIs are passed - it's how GNOME Shell does its 'new window' magic. However, it should not do so if the instance that is already running is a headless instance that happens to be active, and resumes a session when called with or without URIs.
Actually setting the flag at that point doesn't seem to work well - it gets set in cases where it shouldn't. I made session_resume return FALSE if no session is resumed, and took advantage of its boolean return value to decide whether to set the flag.
Attachment 255073 [details] pushed as 21e99b5 - Add a new startup flag to indicate we are resuming a session