Gnome - prevent window focus stealing

I’m currently looking for a way to prevent windows from stealing focus.

I’ve already set my focus-new-window setting to strict, but when I launch applications from terminal, my terminal loses focus.

Mouse behaviour is set to focus on click.

Always on top isn’t a decent workaround, because I’d have to constantly toggle the setting to get the desired behaviour.

I simply want to keep focus on the window I’m using and choose when I switch to a different window. I didn’t find a useful extension, since most seem to enable focus of newly launched applications while disabling notifications.

Have you tried?

gsettings set org.gnome.desktop.wm.preferences auto-raise 'false'

Hi, thanks. Default seems to be set to false, so no joy.

Aha, ok, so after reading a bit in dconf i found this:

So, you will have to set:

gsettings set org.gnome.desktop.wm.preferences focus-new-windows 'strict'

as the default seems to be smart
But even after i restarted shell, is still not so … hmmm.

This also needs to be set like:

gsettings set focus-change-on-pointer-rest 'false'

but gedit is seems to still steal the focus.

Thanks for the feedback.

Changed the settings and re-logged, but focus still shifts whenever an application is launched. I do seem to remember a time when Gnome just gave the notifications without the focus shifts.

Trying to gather some insight into the window focus behaviour on Gnome.
These links seemed to illuminate aspect of the issue and provide some workarounds, but I doubt that I’ll be able to find a solution:

I’m not quite sure in what circumstance someone would use Compiz on Gnome …

That one is good and they point to this extension NoAnnoyance v2 - GNOME Shell Extensions

Hi, thanks for the reply.

It seems like Compiz enforces the strict setting (where windows don’t steal focus and aren’t raised) better than Mutter does. I’ve been seeing it pop up as a solution to this problem a couple of times, but as the linked discussion indicates that it’s no longer in the official repositories, I’m not too keen on using it if it breaks every time Manjaro gets an update.

NoAnnoyance v2 seems to do the opposite of what I’m trying to achieve, unless I’ve misunderstood its functionality.
I am starting to appreciate the complexity of the problem, since I actually want certain applications to lose focus and switch to the new window when launching an application.

Desired behaviour:

  • Terminal should not lose focus and new windows should not be raised when launching an application through terminal.
  • Steam should switch to the new window when launching a game.

Currently when a new window is created, it is raised and gets focus. I can turn the notifications off I guess, since they serve no purpose at the moment.