You are not logged in.

#1 2009-10-09 02:38:17

tacitdynamite
Member
Registered: 2009-07-28
Posts: 12

Awesome WM: how to prevent focus stealing

Hello all,
I've been using awesome wm for about four months now, but I still haven't yet really figured out how to prevent other applications from stealing focus. This is an important topic to me, because I'm into live coding for music, and when I spawn a visualization, it steals the focus from vim, preventing the live coding until I can navigate back over.  Anyone know how to lock focus in awesome wm?
tacitdynamite

Offline

#2 2009-10-09 03:13:31

renato_garcia
Member
From: Brazil
Registered: 2009-08-14
Posts: 24

Re: Awesome WM: how to prevent focus stealing

In the file rc.lua, there are one function "awful.hooks.manage.register". This function is called when a new client appears, and among other things, in the line "client.focus = c" it passes the focus to the new client.

You may make a condition to call or not this command, depending of who is the new client.

Last edited by renato_garcia (2009-10-09 03:15:33)

Offline

#3 2013-12-09 08:05:50

bijan
Member
Registered: 2013-11-13
Posts: 3

Re: Awesome WM: how to prevent focus stealing

I know it's a very (4 years) old post but just now i was tired of keyboard focus stealing specially when i just boot up the system and need to run a few programs altogether while running some commands on terminal. it's really annoying to lose focus on terminal when a program lunches for any reason. my solution was to disable focusing the newly opened clients. so for future readers the solution for me:

apparently this is the job of "awful.rules" which governs the clients behaviors (i just read the rc.lua so correct me if i'm wrong). find the following code:

awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
      properties = { border_width = beautiful.border_width,
                     border_color = beautiful.border_normal,
                     focus = true,
                     keys = clientkeys,
                     buttons = clientbuttons } },

Here, the rule for all clients says to focus on every client which opens automatically. to disable that, just comment the line setting focus to true. the final code should looks like:

awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
      properties = { border_width = beautiful.border_width,
                     border_color = beautiful.border_normal,
                     -- focus = true,
                     keys = clientkeys,
                     buttons = clientbuttons } },

Finally you need to restart the window manager for changes to affects (probably using Super+Ctrl+R).

Offline

#4 2013-12-09 08:16:14

fengjingge
Member
Registered: 2013-12-09
Posts: 2

Re: Awesome WM: how to prevent focus stealing

thanks

Offline

#5 2013-12-10 02:10:58

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: Awesome WM: how to prevent focus stealing

Thanks.

This fixed the problem for most programs. However I found it didn't work for Firefox (I like to yank URLs from mutt in rxvt-unicode). I had to set the following "about:config" entries to true:

  • browser.tabs.loadBookmarksInBackground

  • browser.tabs.loadDivertedInBackground

  • browser.tabs.loadInBackground (defaults to true)

Documentation is there : http://kb.mozillazine.org/Firefox_:_FAQ … s#Browser..

Last edited by a_neutrino (2013-12-10 02:24:04)

Offline

#6 2013-12-13 19:31:53

physicist
Member
From: Germany
Registered: 2013-12-13
Posts: 2
Website

Re: Awesome WM: how to prevent focus stealing

This seems to apply to windows that spawn a new window. What about existing windows that steal the focus, like Skype chats to? Skype is driving me crazy that way.

Offline

Board footer

Powered by FluxBB