How to stop stealing windows focus?

I have been using Ubuntu (with Gnome) for like almost 20 years and I know one of the best features in Linux desktop is to prevent applications to steal focus. One of the things I hate about Windows the most.

For example I am in text editor typing something. Then I think I would like to have LibreOffice Calc to do some calculation. From dock I click on LbireOffice Calc icon and click back inside my opened text editor window and continue typing. On my older laptop launching application just takes like two to three seconds. It used to work like this, LibreOffice Calc was opened in background and system notification was displayed “Window is Ready”.

But know when LibreOffice Calc is ready it is suddenly just displayed over my existing text edtior. Stealing window focus. I hate this.

I don’t know if this is some specific to Blufin 40 (from stable channel), because I know this was not working like this on Ubuntu or was there some recent Gnome update or something…

This was just one of the best features in Linux desktop I hope I will not lose this.

What I hate the most in Windows is, when I am typing something in text editor and I want to press Enter to get into next line and then at the same moment some application steals focus and displays some Yes/No dialog and pressing Enter and “Yes” button is applied. Bad bad bad design…

I see on Windows (but have not seen it on Linux desktop) some of the applications do not steal focus but instead taskbar icon is blinked few times indicating some attention is required on that window - this is way better design.

Do you think this is Blufin 40 specifics or there was some Gnome update or some setting has changed?

We don’t touch the stock focus behavior afaict, but what you’re describing sounds like this extension: Steal my focus window - GNOME Shell Extensions

@j0rge, your suggested extension does exactly opposite what I want.

Extension: prevent notification “Application is ready” and launched application steal window focus.

I want: display notification and launched application do NOT steal window focus.


I have now fresh installed Ubuntu 24.4.1 LTS and Ubuntu 24.10 to test. What I see by default both behaves like Blufin. New launched application steals focus.

I have found and article about Gnome stealing window focus and at the end there is command.


On the following systems I retried gnome-shell version with gnome-shell --version

  • Blufin 40 from stable channel → uses gnome-shell 46.5
  • Ubuntu 24.4.1 LTS → uses gnome-shell 46.0
  • Ubuntu 24.10 → uses gnome-shell 47.0

and then performed bellow tests.

  1. Start Text Editor and make sure you maximize the editor.
  2. Start typing.
  3. Click on LibreOffice Calc (I have pinned the app to dock) from dock.
  4. Immediately click back to maximized text editor and continue typing.
  5. In all three systems LibreOffice Calc after few seconds when it is started up steals window focus. Exactly what I don’t want.
  6. Now get the focus settings:
    gsettings get org.gnome.desktop.wm.preferences focus-new-windows
  7. Above command displays “smart” which is somehow some mixed solution for focus stealing.
  8. Change setting to ‘strict’:
    gsettings set org.gnome.desktop.wm.preferences focus-new-windows 'strict'
  9. Repeat steps from 1 to 4 (including). Result: Both Ubuntus do not steal focus but Blufin does steal focus.

Now I am baffling:

  1. Did I also change some other setting on my Blufin that I don’t remember and has effect to windows focus?
  2. Did I do something differently on Ubuntus then Blufin?
  3. Is this effect of different Gnome shell versions?
  4. Is this effect of some setting in Blufin (set in project itself)?
  5. Something else I currently (or maybe never) can’t see?

Can someone else do above test in Blufin 40 to confirm the issue?

EDIT: Additional test in Blufin in Extension Manager at the top first setting I have disabled all of extensions and the problem remains. At least not extension issue.

Yeah I know I just wanted to doublecheck that there wasn’t an extension installed because the behavior you describe doesn’t sound like the fefault behavior.

EDIT: This is the only place we touch that key:

Now I double checked and I see in Ubuntus I have set “Extended” when installing operating system (Default is Minimal). In this case LibreOffice is install using standard deb package.

I uninstalled deb package and configured flatpak.

sudo apt -y purge libreoffice*
sudo apt -y autoremove

sudo apt -y install flatpak

sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

sudo reboot

flatpak install -y org.libreoffice.LibreOffice

Super key and type in “libreoffice cal” and right click and Pin to Dash.

Now do the test (steps 1 to 4).

The same behaviour:

  • click from dash or
  • flatpak run org.libreoffice.LibreOffice --calc

In Ubuntu focus is still not stolen in flatpak version and gsettings set to “strict”, just like I want.

Still a mystery… Don’t know what is the issue… maybe some gnome-shell 46.5 change that was reverted back in 47.0, just wild guessing. Will see what will happen when Blufin 41 is relased with gnome-shell 47.0 I assume.

You could try:

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

Also to change focus behavior you can use the tweaks app.

And if you want a window to force stay focused you can right-click window header bar and choose Always on Top.

@Plyply, I have checked and auto-raise was already set to false.

I have also tested all of the options in Gnome Tweaks tools from Windows Focus options (your print screen). Nothing fixes the issue I have described.

“Always on top” requires Text Editor to not be maximized, but I like it maximized. Also when I do want to use LibreOffice Calc I can’t switch to it, because Text Editor is always on top. Movign and resizing window is also time consuming… and more annoying then stole window focus.


Just wondering, did someone test this behaviour? My steps above… and can confirm the issue on your system?

I have Gnome set up like a tiled window manager so can’t really test for you.

The Gnome article you linked to earlier does talk about Gnome’s behavior being problematic sometimes. Especially how, depending if the app implements focus behavior properly.

Personally I love Gnome but they do tend to overthink things. They should give an option to prevent focus stealing completely.

I have installed fresh new Blufin GTS, set “strict” setting and excellent problem does NOT appears.

Upgraded to stable channel did the same test and problem also does NOT appear.

Holly caw, this looks like problem only on my original Blufin. Looks like I have messed something to get into this stealing focus window issue.

EDIT: I have now migrated to new fresh installed Blufin 40 and I have no window stealing focus issue anymore.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.