Gnome shell Window auto-focus not working for specific applications

I am using fedora 37 with kernel version 6.2.9.
Some of the applications like gnome-terminal and gnome software store when launched from the Dash in gnome-shell are not focused i.e. they are not being auto-focused.
But when they are launched from other way like by gnome search they are working as expected and being auto-focused.

Other applications are working fine even if they are launched from the Dash.
Another thing is that when some other application is opened for example Firefox or nautilus then launching gnome-terminal or gnome software store works as expected and are auto-focused.

I installed console application which is also a terminal emulator by gnome project. It is also showing the same issue as gnome-terminal and gnome software store.
I think the applications which use the shell (using: Bash) directly or in background, are showing this kind of issues.

I tried setting gsettings set org.gnome.desktop.wm.preferences focus-new-windows 'smart', but it makes no difference.

This problem started showing after the last update which includes updating the kernel from 6.1.18 to 6.2.9, updating mutter and nvidia driver update.

Install a Gnome Shell extension that auto focuses new windows. NoAnnoyance v2 by bjoerndaase is dedicated to only this, but several extensions like Dash to Dock, Unite, Just Perfection, … include that also as an option.

Installing the extension will be a work around. I think you didn’t understand the situation, this problems only occurs with the applications which use the shell and other applications just work fine. I am trying to find out why this started happening and what is the reason behind it.

I am trying to find a solution without installing an extension.

Installing the suggested extension may “fix” the problem, but it may merely hide the cause.
I agree that finding the cause is a better long term solution.

Can you identify specific apps that do or do not have this issue, after verifying that the system is 100% fully up to date with either sudo dnf upgrade --refresh or sudo dnf distro-sync --refresh?

Identifying the specific apps and being fully updated may assist in identifying the cause.

Thanks for understanding the issue and my point of view.
Yeah my system is up-to date and as well as flatpak apps are also up-to date. I checked with sudo dnf upgrade --refresh and flatpak update.
As far as I have noticed the issue, it follows a pattern. It occurs only to applications which use the shell (for my case it is Bash) only when they are launch from the Dash in gnome-shell otherwise, it works fine (like if it is launched from the gnome search). The gnome terminal uses Bash shell and as well as the Console application. The gnome-software store is also showing the issue, I think that is because the gnome-software uses the shell or some kind in background to search for update and update the applications. In my system these three applications are showing this issue and these are the only applications in my system that uses the shell directly or indirectly.
Other applications are working just fine even. I think as they don’t uses the shell directly or indirectly.
I could not make any sense of this problem. It is total a weird problem.

Good luck finding a solution without extension. I guess that will involve you filing an issue to the Gnome Shell developpers. As a work around for the short term, you may still want to consider installing the extension.

I’m having this same issue, it started cropping up on all of my machines over the past month on both GNOME 43 and 44. I have tried disabling all of my extensions and adding NoAnnoyancesV2 (GNOME 43) and Just Perfection (GNOME 44) to fix the window focusing issue to no avail. However, I can’t replicate the issue in a VM on a fresh install so I think there is a gsettings or other userspace culprit.

Edit: I reset gsettings and sill had the issue, I think the VM mutter was from before the commit that introduced the issue. I think this MR should fix it.

Ohh. I see. That was commit which actually introduced the issue. I don’t understand why someone will do that kind of commit that breaks the thing rather than fixing.

Thanks for creating the merge request. I hope it will soon be merged and issue will be solved.

The issue is also replicable via the Fedora 38 live media, as long as you have “Open new instance” on. Open a Terminal window, then open a second Terminal window either from a shortcut pinned to dash, or via super key search. Open as many Terminal windows as you like, but focus will never leave the original one you started with.

Thanks OP for starting this thread, this has been driving me nuts for a while trying to figure out why this behavior started out of nowhere. Since the merge request was rejected (keeping this bug in place), for now I think using an extension will be the only way to get back to correct focus behavior.

Update: oops, the NoAnnoyance extension isn’t updated for F38 yet, but hopefully does fix things for people still on F37.

I cannot reproduce that. I am using the Unite extension with its “Focus new windows” option on.

“Default” experience of Gnome Shell is not to focus windows of loading applications. I do not know how many people like that behavior, but apparently developers like that in some cases - launch processes and have their output not interrupt current work immediately.

An issue with focus when using the overview is reported here.

Hi, two things: 1) apologies for bumping this thread but I’m having the same issue under Fedora 37 and didn’t want to open a new thread; and 2) this does not appear to be Fedora-specific. I originally believed it was a Fedora problem, and so I clean-installed Arch only to discover this same thing happens in GNOME running on Arch, too (both in GNOME 43 and GNOME 44). In other words, I’m pretty sure it’s a GNOME problem.

The weird thing for me is that it only happens on a specific computer: I just bought a new Lenovo Ideapad 3 with an AMD Ryzen 5 5600H processor and an NVMe TLC SSD. This machine is faster than any computer I’ve ever owned, and it almost seems to me like this problem is caused by the hardware being too fast for the software. Could that be true, or am I just making stuff up? I also have Arch installed on an older Ryzen3 Thinkpad E455 and I don’t experience this problem there (previously I had Fedora 37 on the E455, too, also without issues).

I will say the NoAnnoyance v2 extension does not solve this problem for me: gnome-terminal (and all terminal emulators that I tested) still launch un-focused. Other terminal emulators I tested were: foot, kitty, console, rxvt-unicode, and terminator; all have the same problem.

I cannot seem to make heads or tails of the comments here. Can someone help me understand either a) what is causing this or b) what can be done about it? Would it be prudent to file a bug report with GNOME?

I believe this is a mutter issue but what you are describing sounds like some sort of race condition. The author believes that the committed code is correct so maybe the “fix” exposed a deeper issue? I’m experiencing the issue on Kaby Lake mobile CPUs and AMD desktop APUs so maybe not drivers or hardware acceleration? OTOH I’d have expected this to gain more traction if it affected everyone on newer mutter?

@cryobry thanks for the info! My account was deactivated in Nov and I cannot seem to reactivate it, but I am 100% in agreement with you that this issue is super disruptive to my workflow. I do so much of my work in terminal; muscle memory is such that I launch terminal from overview and begin issuing commands, sometimes without looking up. It’s only after I hit enter that I realize I just sent that command as an email since it was my email that retained focus when I launched terminal. Good times.

Something specific must be going on here because I do not manage in any way to reproduce the issue, with all extensions disabled. Perhaps it would be good to provide steps to reproduce the issue. I seem to understand that this only happens when launching the terminal from the Dash (i.e., clicking on it in the Dash?), and not while Firefox is loaded or is in the foreground?

Suddenly I am also hit by in issue in this sense. Strange, because I did not see an incoming update today. I had a full screen evince window. I summoned the terminal, and it was focussed (name displayed in the top bar, something I typed ended up there) but remained hidden after the evince window in front. With the terminal active, hitting Supper+PgDn to move it to another workspace made it visible, and since then I was unable to reproduce the issue again.