为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Preventing Focus Stealing When Restoring Session

  • 3 个回答
  • 1 人有此问题
  • 17 次查看
  • 最后回复者为 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?

所有回复 (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