Raising Windows in GNOME 3

2021-01-27 18:29:12

Since switching from Windows to Linux as my primary OS, things have mostly been going well, but one thing has been a consistent annoyance: in GNOME 3, new windows opened by applications tend to open in the background, giving a notification that "X is ready". Very annoying.

I found advice (e.g. here) to change a setting using dconf-editor, or from the command line:

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

This... didn't seem to work. Some windows would pop up as expected, but others wouldn't. To make emacs windows pop up properly, I tried some code like (progn (raise-frame) (x-focus-frame (selected-frame))), which also only sometimes seemed to work.

In the end, I found a simpler solution: the NoAnnoyance GNOME shell extension by sindex. It doesn't alter the focus-new-windows setting or anything; it hooks the window-demands-attention and window-marked-urgent events, and then calls activateWindow on them.

Simple, and it actually works.