New windows sometimes open in the background [$180]

Bug #1220179 reported by oscarfroberg
532
This bug affects 114 people
Affects Status Importance Assigned to Milestone
Gala
Confirmed
High
Unassigned
elementary OS
Confirmed
High
Unassigned

Bug Description

Excpected behavior: When I launch a second instance of an app I expect it to pop up to the foreground and take focus.
What happens instead: This behavior is not consistent.

Let's say you have your web browser open and then open a terminal (using Ctrl-Alt-T or whatever method). It opens to the foreground and takes focus as it should. Then when you open another terminal it also pops up to the foreground and takes focus. This behavior is expected, no complaints here, BUT here comes the bug:

While having your browser open (I use Firefox), open a terminal (which takes focus in the foreground as it should) and then put focus back to the browser and from there fire up a new terminal, it opens in the background (red bounch animation in the dock)! This is very annoying and can hardly be a feature?

This bug is also SOMETIMES present when having Firefox open and firing up Chromium. Sometimes Chromium pops to the foreground as it should, sometimes it doesn't. Don't have any more detailed info off the top of my head but can't seem to recall any other app pair behaving like this, at least often enough to annoy me.

Note: I have my dock on autohide (which doesn't seem to matter, I just reproduced the bug with "hide on maximize").

Summary:
open terminal -> open another terminal = WORKS (the second terminal takes focus)
open terminal -> open another app -> open another terminal = DOESN'T (the second terminal opens in background)

Related branches

Revision history for this message
oscarfroberg (oscarfroberg) wrote :

I installed gnome-terminal yesterday and set it as the default terminal, which made the problem go away. It would seem that the behavior is directly related to pantheon-terminal.

Revision history for this message
Oktay Acikalin (oktay-acikalin) wrote :

Problem is, that I can reproduce this bug with every app which can handle multiple windows and open them using shortcuts or other means. For example open Sublime Text 3, open a terminal and run subl -n ~/.bashrc. This opens a second window of sublime but does not pull it to the front. It just opens the window in the background. I like the idea and it would perhaps make sense in some ways, but by default its kind of annoying.

Revision history for this message
Diego Castro (diego-castro) wrote :

This bug happens with with every app. It is very annoying to open an app and have to click on it on plank.

Revision history for this message
goroskob (goroskob) wrote :

It also happens when restoring application from tray icon.

Revision history for this message
Niclas Åhdén (niclas-c) wrote :
summary: - New windows sometimes open in the background
+ New windows sometimes open in the background [$50]
Phillip Sz (phillip-sz)
Changed in elementaryos:
status: New → Confirmed
Changed in gala:
status: New → Confirmed
Revision history for this message
Niclas Åhdén (niclas-c) wrote : Re: New windows sometimes open in the background [$50]

The user watching_cat added another $15 to the bounty making it $65.

summary: - New windows sometimes open in the background [$50]
+ New windows sometimes open in the background [$65]
Revision history for this message
Gabriel-LG (gabriel-lg) wrote : Re: New windows sometimes open in the background [$65]

This issue also occurs with particular programs that switch to a running process when started. e.g. Transmission will stay minimized when it is started while already running.

Midori also shows strange behavior when started while minimized; It will bring the minimized instance to the foreground, then start a new browser window, and then minimize both browser windows.

Revision history for this message
oscarfroberg (oscarfroberg) wrote :

Unfortunately this behavior was so annoying that I switched from eOS a week or two after posting this bug. The priorities of the dev team aren't exactly in order if they are working on new features for the next release instead of tweaking the current one that has huge bugs like these, which shouldn't even be hard to fix.

On the other hand, yes, they are a small team with limited resources, but I will not look forwards to nor can I recommend this or the next release to my Linux noob friends (or anyone else for that matter) if the quality of support for current releases is going to be like this.

By the way, is it known if this affects all users or just some?

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

Sorry for your inconvenience. Unfortunately the source of this bug are very deep in gtk code, it's not actually related to gala. Thanks to the guys over at GNOME it looks like we got this fixed in gtk now or soon https://bugzilla.gnome.org/show_bug.cgi?id=721145 I'm still tesing this patch that has been linked most recently. Question is however, if we will be able to backport this patch. If not, maybe we can cheat and get gala to override the behavior, but at the moment I'm very busy. I really hope I'll be able to get back on this the coming weekend, it already took me quite some time to figure out where the problem actually came from.

Changed in gala:
status: Confirmed → In Progress
Revision history for this message
Niclas Åhdén (niclas-c) wrote :

Thanks Tom, it's really great that you're working on it.

Revision history for this message
marianitn (marianitn) wrote :

Just FYI, this bug is still present on freya-beta1 with GTK 3.12.2. Will this bug be targeted for freya?

Revision history for this message
PerfectCarl (name-is-carl) wrote :

This issue may be the root cause of https://bugs.launchpad.net/noise/+bug/1301952.
The noise bug must be retested once this issue is fixed.

Revision history for this message
Oktay Acikalin (oktay-acikalin) wrote :

Tom, do you mind knocking at the GNOME peoples door again? I don't understand why the bug report over there has been marked as resolved and invalid...

Revision history for this message
Brandon Taylor (raisonbran648) wrote :

I can recreate this error with all applications.

Step 1: Maximize a window.
Step 2: Minimize a different window.
Step 3: Open a window of the same grouping that is currently minimized.

The new window will open minimized.
The desired action is the new window opening to the very front, on top of the maximized window.

Revision history for this message
Ash (ash1991) wrote :

Just to make reproducing steps more accurate:

Step 1: Maximize a window.
Step 2: Minimize a different window.(make sure it's not maximized first -> unmaximize it first)
Step 3: Open a window of the same grouping that is currently minimized.

The new window will open minimized.
The desired action is the new window opening to the very front, on top of the maximized window.

Revision history for this message
Or Schiro (orschiro) wrote :

I can confirm this issue.

For example, if I click on an email address (mailto link) in Chromium, then my Thunderbird compose window opens behind Chromium but not in the foreground. I believe this is not the desired behaviour.

Something similar is happening with Terminal windows. They sometimes open in the very background and I have to use Super + W to find them.

I am using Freya Beta 2 with the latest installed updates from unstable.

Revision history for this message
Ruchir (ruchir-brahmbhatt) wrote :

I can confirm this too. Most apps always opens in background. Usually I have chromium running maximized. When I need to access file manager, terminal, skype or other apps from plank, they mostly open in background and then I have click respective icon again to bring the app to foreground.

Revision history for this message
roberto (robbbbye) wrote :

(freya stable) I have a similar error:
When I download a thing in chrome and I click on "show in folder" it'll open the window/tab in background, so I get a red dot under Files icon in Plank and only if I open it I can see the file.

I guess that is related to this two too:
1.(When Files is opened but it's minimized) Click with the right button of the mouse on Files > "new tab". This time I don't get a red dot but it'll open the new tab again in backgrond
2.(When Files is opened but it's minimized) Click with the right button of the mouse on System Settings > click on one of the things available (for example let's say "personal" > "application") again, It'll open in background the "application" tab but in background!

Revision history for this message
roberto (robbbbye) wrote :

In the previous comment at the "2." point I wanted to write -> (when System Settings is opened but it's minimized)

Revision history for this message
Xander (xander-deseyn) wrote :

Can confirm this is still happening, on a fresh install. I saw that the bug in GTK was fixed in the remote bug tracker, any idea when we will get the fix?

Revision history for this message
Espen Hovlandsdal (a-espen) wrote :

This bug is really annoying - anything we can do to get this fix in elementary? Contributed to the bounty on this, in case that helps.

Revision history for this message
davidak (davidak) wrote :

I still have this bug with the Screenshot app and Chromium.

Revision history for this message
Dave (dav666666) wrote :

I can't believe this is still open, it's been two years since the original bug report. I can confirm Chromium is still affected by this issue, as it's the reason I came here in the first place.

Revision history for this message
Jasper St. Pierre (jstpierre) wrote :

Hi. I'm the developer of mutter. Can anybody give me *concrete* steps to reproduce this issue? I tried the terminal shortcut steps above and it worked fine.

I unfortunately can't test on actual Elementary OS, but I can see if the same steps break on upstream mutter or GNOME. If they don't, it might be fixed in the latest upstream mutter, and would be fixed by a rebase to mutter 3.16.

Revision history for this message
Jasper St. Pierre (jstpierre) wrote :

Managed to reproduce this. Ugh. It's a complicated issue going back for years.

The best technical explanation I can find is https://bugzilla.gnome.org/show_bug.cgi?id=149028#c32

I'll talk to Owen, Ryan and Alex about this on Monday to see if we can come up with some ideas about this. Perhaps "any windows launched from within a GtkApplication command_line / open / activate handler shouldn't get a global user timestamp" is acceptable.

Revision history for this message
Jasper St. Pierre (jstpierre) wrote :

A new bug and temporary patches have been filed at https://bugzilla.gnome.org/show_bug.cgi?id=752000

Revision history for this message
Dave (dav666666) wrote :

Thank you for looking into this ! Don't forget to remind them about the bounty, it is currently at $100 on bountysource ! ;-)

Revision history for this message
Luke Berner (lukeber4) wrote :

Hi all. I don't know if this 'solves' the issue, but worked for me:

http://askubuntu.com/questions/310470/newly-opened-applications-open-in-background

Maybe it can help you with a true solution.

Cheers,
L.

Revision history for this message
Jasper St. Pierre (jstpierre) wrote :

The GTK+ side of the bug has been fixed. This does *not* guarantee that all cases of this are fixed, simply that the one that I investigated: Chromium launching other apps.

If you guys are still seeing this after the GTK+ patch has landed, *please* give me a set of step-by-step instructions to reproduce it.

Daniel Fore (danrabbit)
Changed in elementaryos:
milestone: none → loki-beta1
Changed in gala:
milestone: none → loki-beta1
Cody Garver (codygarver)
Changed in elementaryos:
importance: Undecided → High
Changed in gala:
importance: Undecided → High
Revision history for this message
Adrián Carreño (adriancarreno-d) wrote :

Hello everybody.

It's been more than 2 years since this bug was reported and I can confirm it still persists. I have elementary OS 0.3.1 Freya (64-bit), and almost every time I open Geary from Plank or the notification area while other program is maximized and focused (I tried with Chrome, Wolfram Mathematica, Pantheon Files and many others), it opens in background. Same thing when trying to open Spotify from tray.

The funny thing is that when Geary wasn't maximized on last execution, it launches on foreground even with other programs maximized and focused.

Any ideas on how to fix that?

Changed in gala:
status: In Progress → Confirmed
Revision history for this message
Zisu Andrei (matzipan) wrote :

This issue still manifests in Loki.

Revision history for this message
Jakub Klos (9v-ka2ub-3y) wrote :

I can also confirm it still occurs on Elementary 0.3.2
Reproduction is simple

1. Using Pantheon terminal
- start terminal
- run gedit
- focus some other window
- start another tab or window of the terminal
- run gedit
it opens a new tab but does not focus the gedit app

(if you however run gedit from the Applications menu it works)

2. Using Applications menu and Chrome
- start Chrome from Applications menu
- focus another window
- start Chrome again
the new window stays in the background

I love elementary but this is becoming really serious
Thank you

Daniel Fore (danrabbit)
summary: - New windows sometimes open in the background [$65]
+ New windows sometimes open in the background [$130]
tags: added: bounty
Daniel Fore (danrabbit)
Changed in gala:
milestone: loki-beta1 → none
Changed in elementaryos:
milestone: loki-beta1 → loki+1-beta1
Daniel Fore (danrabbit)
summary: - New windows sometimes open in the background [$130]
+ New windows sometimes open in the background [$140]
Revision history for this message
m (elmato) wrote : Re: New windows sometimes open in the background [$140]

Does Loki+1 mean this has been triaged?

Maxim Taranov (png2378)
summary: - New windows sometimes open in the background [$140]
+ New windows sometimes open in the background [$160]
Revision history for this message
Artemis Entreri (mongodada) wrote : Re: New windows sometimes open in the background [$160]

Running the new Loki release and the problem exists.

But I have only reproduced the problem with the App center and Pantheon Terminal.
Basically if you have another window open before you open the pantheon-terminal or app center
the focus is still on the previously open window/application.
However if there are no other windows/apps open or if all other windows are minimized to Plank the focus works.

J.Ar (j.ar)
summary: - New windows sometimes open in the background [$160]
+ New windows sometimes open in the background [$175]
Revision history for this message
Guest (guest2020-deactivatedaccount) wrote : Re: New windows sometimes open in the background [$175]

I can't reproduce any of these scenarios on Loki 0.4 (x64).

1. Open Terminal (Super + T).
2. Focus on another window.
3. Open another Terminal (Super + T)
= Second Terminal window opens in foreground.

1. Open Terminal (Super + T).
2. Run gedit.
3. Focus on another window.
4. Open new Terminal window or add new tab to existing Terminal window.
5. Run gedit.
= New tab in gedit opens, and gedit is brought to foreground.

I've reproduced these and all the others on this page, but none of them result the same behavior. Bug fixed?

Revision history for this message
Zisu Andrei (matzipan) wrote :

Joshua, this issue is still present.

Revision history for this message
hotovo (hotovo) wrote :

Any yupdate on this? It's bug with most heat, with bounty and here for years and it is still not fixed? What is a problem?

Revision history for this message
Adam Bieńkowski (donadigo) wrote :

hotovo: there is some discussion going on right now in our private Slack channel. This is the current branch that gets discussed: https://code.launchpad.net/~philip.scott/gala/raise-new-windows/+merge/311366

Revision history for this message
hotovo (hotovo) wrote :

Hi Adam , thank you for a quick response. So does it mean it should be fixed soon rather then in OS juno-beta1?

Daniel Fore (danrabbit)
summary: - New windows sometimes open in the background [$175]
+ New windows sometimes open in the background [$180]
Revision history for this message
Justin T (teetron9k) wrote :

I can confirm this bug (4 years old) still persists in the latest release (0.4.1).

The overall impact on user experience... if you haven't personally experienced it, then, frankly: you are not able to comprehend how uniquely maddening it is.

I have an (unusually) high tolerance for terrible user interfaces -- I'm a long-time Linux user, after all -- but this...

Somehow, this "minor" (and I mean it: in the grand scheme of things, I really would call this minor) bug causes unending existential dismay in the hearts of all who experience it. (I'm not a psychologist, but I imagine it must involve the perverse, inexplicable differences between the expected and actual outcomes.)

Any fix? ETA?

Revision history for this message
Jasper St. Pierre (jstpierre) wrote :

Just to double check, you are launching the terminal with the proper launch API (g_app_launch with a GdkAppLaunchContext), not by spawning an executable, right? Focus stealing will take effect for apps simply forked without proper timestamps passed through.

Revision history for this message
Slavic Dragovtev (slavicd) wrote :

Fedora 28 with gnome 3.28; the issue is still here and just as annoying.

Revision history for this message
Giovanni Tirloni (gtirloni) wrote :

Experiencing this with Fedora 29 and GNOME 3.30.2.

How to reproduce:

1. Open Chrome browser or gnome-terminal
2. Hit 'Ctrl-N'
3. New window pops up behind the window with focus

When that works fine:

1. Open Chrome browser
2. Hit 'Ctrl-Shift'N' (incognito)
3. Window opens in front of existing windows

This happened in the past with Fedora 28 and unexpected started to work fine. Now it's back.

Disabling all extensions doesn't seem to help.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.