how to prevent new windows from stealing focus in gnome

17,135

Solution 1

My best solution for this so far is to install Compiz and within it take the following actions: select "General Options" from the top of the first window, open the "Focus & Raise Behaviour" tab, select "Very High" from the "Focus Prevention Level" dropdown, and enter "any" in the "Focus Prevention Windows" text box.

I'm getting used to the fact that I need to visually scan the applications at the bottom of the window on a regular basis and it produces some odd behaviors such as applications which previously had focus but then yield it to other applications after a dialog has been completed.

Still looking for better solutions for this, and I expect that I could get better behavior by tweaking the settings in Compiz, but I'm too busy for this.

Solution 2

It's funny that I found the solution for my Ubuntu and GNOME on OpenSolaris FAQ:

The solution is to start:

gconftool-2 -s -t string /apps/metacity/general/focus_new_windows "strict"

or, alternatively you can start gconf-editor and fix /apps/metacity/general/focus_new_windows to "strict"

Solution 3

That didn't work for me in Ubuntu 16.04. Nor did adjusting Desktop>wm>preferences>auto-raise via the dconf Editor.

What does work is making sure you have the compizconfig-settings-manager installed. Then (I don't know of a way to reach that advanced utility via the UI), you can run the command from a Terminal: ccsm

Then you click on the General options and in there, click on the Focus & Raise Behaviour tab. You need to change the Focus Prevention Level from Low to Normal (at least).

(Workrave started driving me mad when something recently changed and it started stealing focus while I was writing and not looking at the screen!)

Share:
17,135

Related videos on Youtube

BD at Rivenhill
Author by

BD at Rivenhill

I'm working on the following projects (not necessarily in order): Software for automated trading (focusing on both high throughput and low latency) Robots

Updated on September 17, 2022

Comments

  • BD at Rivenhill
    BD at Rivenhill over 1 year

    I'm running Ubuntu 9.04 and I have the window manager configured for "focus follows mouse" but new application windows will steal the focus. Seems like there are many threads out there complaining about this behavior, but I see no solutions, am I missing something?

  • Aquarius Power
    Aquarius Power almost 10 years
    did you found a workaround? I was thinking, there is a opacity mod at ccsm that if we put all windows at like 95% (slightly transparent), we would know when another window pops up (just below the focused window) and would be less troubling that dont knowing it spawned.. still have to try it tho... may be annoying also..
  • Aquarius Power
    Aquarius Power almost 10 years
    at ccsm "opacity,brightness and saturation" add a opacity rule with 95 value (set the value first) and type "any" without quotes on the window matcher, it works perfectly to know a window spawned behind the current one! :)
  • ThorSummoner
    ThorSummoner almost 7 years
    The description of that property under cinnamon (org.cinnamon.desktop.wm.preferences) is: "This option provides additional control over how newly created windows get focus. It has two possible values; "smart" applies the user's normal focus mode, and "strict" results in windows started from a terminal not being given focus."