Ubuntu – How to prevent notifications from grabbing focus in 18.04

18.04focusgnome-shellnotification

I updated from 16.04 LTS to 18.04 last year, and the Gnome notifications are a nuisance. In 16.04 with Unity, notifications would not grab focus, they'd just appear as an overlay in the corner — you couldn't even click on them. In 18.04 with Gnome, when a notification pops up, it grabs focus from the current window. This is really disruptive, since I routinely have to monitor multiple chat channels that send notifications to me. I'll be in the middle of typing something in one channel when a notification from another interrupts, causing me to type several letters into the void before I manually get the cursor back where it's supposed to be, completely breaking my flow.

I definitely need to be aware of the notifications as they come in, so I can't just block, mute, or hide them, but I don't want them to interrupt what I'm doing when they appear. Is there a way to do this that I'm overlooking? I'd prefer a built-in/official solution over one that requires installing a patch or mod, if possible.

Best Answer

Sometimes a notification popup can take focus
sometimes only
This is because of the smart focus feature of the Gnome Window Manager

A workaround will be to change the smart focus default feature to strict

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