Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Preventing Focus Stealing When Restoring Session

  • 3 replies
  • 1 has this problem
  • 5 views
  • Last reply by cor-el

more options

I am using Firefox 115.3 on Debian 12.1. I have numerous tasks which require the use of my web browser and have allocated a different virtual desktop for each. This means that my browser session typically has several dozen tabs open in numerous windows at one time. Under normal circumstances, this works just fine (and is a testament to the engineering that has gone into this browser).

My issue is that Firefox renders my machine virtually unusable for a few minutes each time I restart my desktop session due to focus stealing. When I open the browser, several dozen windows pop up (as expected) and relocate to their correct virtual desktops (as expected); however, as the windows begin to load, the most recently active Firefox window steals focus repeatedly. If I am, for instance, in the process of typing my password into my desktop e-mail client, a Firefox window may steal focus from the password dialog. In practice, this focus steal happens once every few seconds for several minutes.

I would prefer that Firefox would not steal focus while restoring a session. Does anyone have any suggestions for correcting this issue?

I am using Firefox 115.3 on Debian 12.1. I have numerous tasks which require the use of my web browser and have allocated a different virtual desktop for each. This means that my browser session typically has several dozen tabs open in numerous windows at one time. Under normal circumstances, this works just fine (and is a testament to the engineering that has gone into this browser). My issue is that Firefox renders my machine virtually unusable for a few minutes each time I restart my desktop session due to focus stealing. When I open the browser, several dozen windows pop up (as expected) and relocate to their correct virtual desktops (as expected); however, as the windows begin to load, the most recently active Firefox window steals focus repeatedly. If I am, for instance, in the process of typing my password into my desktop e-mail client, a Firefox window may steal focus from the password dialog. In practice, this focus steal happens once every few seconds for several minutes. I would prefer that Firefox would not steal focus while restoring a session. Does anyone have any suggestions for correcting this issue?

All Replies (3)

more options

Changing /org/gnome/desktop/wm/preferences/focus-new-windows to strict on Ubuntu 23.10 makes windows open in the background for me.

more options

I appreciate the suggestion!

First: I'm using XFCE as my desktop environment. I know there's an XFCE equivalent to the setting that you describe. But second: I *do* want focus to be taken under normal circumstances. It's just during Firefox's startup that I don't want continuous focus stealing.

It turns out that the windows that are stealing focus aren't *new*, either. When I first open Firefox, a few dozen windows pop up immediately (to recover my previous session). The fact that these windows steal focus in the second or two after I start Firefox makes sense to me given my desktop settings. But, for some reason, those windows keep *refocusing* as they start their page load cycles. It is this refocusing behavior that makes my environment unusable and that I would like to prevent.

Thanks again for the response, though. If one is entirely opposed to focus stealing in Gnome, it seems likely that the setting adjustment you describe would do the job.

more options

You can set all tabs to open on demand to avoid that Firefox changes focus to them as they are loading, this also speeds up the startup time.

  • browser.sessionstore.restore_on_demand = true
  • browser.sessionstore.restore_pinned_tabs_on_demand = true