More flexible new window focus setting would be nice

Jarno Suni j_suni at
Sun Feb 22 22:25:07 CET 2009

--- On Fri, 2/20/09, Olivier Fourdan <fourdan at> wrote:

> There seems to be some misunderstanding on how focus
> stealing
> prevention works, and I believe a good understanding of the
> mechanisms
> involved is required to have the right expectations, at
> lest from a
> user point of view.


> Focus stealing prevention requires several conditions to be
> met.
> 1) The currently focused window must maintain and update a
> property
> called _NET_WM_USER_TIME  [1]. This property is used by the
> window
> manager to know when was the last user explicit interaction
> with the
> focused window.

I suppose mouse movement should be registered as such an explicit user interaction, if focus follows mouse setting is used. But just having the mouse cursor at certain position does not guarantee focus will stay at the underlying window even with the setting enabled.

In Xfce 4.4.2 focus is changed only after mouse cursor moves to another window, so moving is not enough. Therefore it can happen that focus does not follow even mouse _movement_, if focus is changed by something else than mouse movement first.

> 2) When mapping a new window, there are two cases:
> 2.a) This is a new application that starts, so that new
> window/application has no previous user interaction. In
> that case,
> startup notification is used to get the timestamp, which
> means that
> *both* the launcher and the launchee must comply with
> startup
> notification standard (and also that startup notification
> is used,
> being compliant is not sufficient if the mechanism is not
> used,
> that's what the toggle "Use startup
> notification" is for in
> xfce4-panel launchers. For the menu, this is determined by
> a specific
> .desktop field)

If startup notification is not used, focus will just follow new window focus policy, right? Otherwise user action may override that policy.

As for launchee must comply with the startup notification standard, I suppose launchee gives focus and raises its window independently of window manager, as otherwise window manager could be used to control it.

"Use startup notification" is useful when having new window focus (and raise) disabled, even if "focus stealing prevention" is not used, as it blinks the new window's (or windows') task list item(s).

> 2.b) If the application is already running (e.g. firefox
> opening a new
> window is not a new instance of firefox, same for Terminal
> or Thunar
> for example), then the newly mapped window should have a
> _NET_WM_USER_TIME corresponding to the actual event that
> lead to the
> creation of the new window.

A new application that starts may open several windows like Firefox, if it is configured to remember windows and tabs from last time. Does Firefox set _NET_WM_USER_TIME for all but the first window opened automatically to be the same that the first Firefox window has?

> Failing to set that timestamp
> correctly
> will result in either the window never or always being
> focused.

Do you mean the new window focus setting is applied then?


More information about the Xfce mailing list