Eugene Pakhomov
Eugene Pakhomov

Reputation: 10727

Force focus client under mouse

There are recipes on how to change focus on mouse move or client change. But what I want, is to prevent any window from stealing focus. E.g. I open a new terminal via the default meta-Enter shortcut, and when it opens it immediately steals focus. Is there any way to prevent it?

Upvotes: 1

Views: 2029

Answers (1)

Emmanuel Lepage Vallee
Emmanuel Lepage Vallee

Reputation: 2762

Yes, it's possible. Focus events can happen in many ways. In the case of the new clients, just comment the focus line in your rules.

For the focus follow mouse, remove the client.focus = c in the mouse::enter section of rc.lua

For specific clients, you can add focus filters:

https://awesomewm.org/apidoc/libraries/awful.ewmh.html#add_activate_filter

For the deepest and most advanced focus control, you can disconnect the default focus handler (awful.ewmh.activate) from the request::activate (Awesome 4.0+) signal and implement your own. In that case, you will have absolute control over every focus events.

Upvotes: 2

Related Questions