After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 707451 - first non-headless instance always opens an additional window
first non-headless instance always opens an additional window
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
3.9.x
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
: 707615 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-09-04 12:01 UTC by Sebastian Keller
Modified: 2013-09-20 10:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a new startup flag to indicate we are resuming a session (2.50 KB, patch)
2013-09-08 06:08 UTC, Gustavo Noronha (kov)
none Details | Review
Add a new startup flag to indicate we are resuming a session (3.18 KB, patch)
2013-09-17 01:00 UTC, Gustavo Noronha (kov)
committed Details | Review

Description Sebastian Keller 2013-09-04 12:01:59 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.
Comment 1 Claudio Saavedra 2013-09-05 13:34:45 UTC
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.
Comment 2 Claudio Saavedra 2013-09-05 14:00:17 UTC
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...
Comment 3 Gustavo Noronha (kov) 2013-09-05 15:31:18 UTC
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?
Comment 4 Gustavo Noronha (kov) 2013-09-05 16:03:30 UTC
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!
Comment 5 Claudio Saavedra 2013-09-06 10:32:48 UTC
*** Bug 707615 has been marked as a duplicate of this bug. ***
Comment 6 Gustavo Noronha (kov) 2013-09-08 06:08:32 UTC
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.
Comment 7 Gustavo Noronha (kov) 2013-09-08 06:09:48 UTC
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.
Comment 8 Gustavo Noronha (kov) 2013-09-17 01:00:52 UTC
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.
Comment 9 Gustavo Noronha (kov) 2013-09-17 01:03:07 UTC
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.
Comment 10 Claudio Saavedra 2013-09-20 10:25:56 UTC
Attachment 255073 [details] pushed as 21e99b5 - Add a new startup flag to indicate we are resuming a session