Hi again!

On Thu, Apr 23, 2009 at 9:16 PM, Nelson A. de Oliveira <[email protected]> wrote:
> On Thu, Apr 23, 2009 at 8:50 PM, Gregor Best <[email protected]> wrote:
>> Regarding your question about focus:
>>
>> I just added the following to my rc.lua:
>>
>>  awful.hooks.arrange.register(function (screen)
>>    if awful.layout.get(screen) ~= awful.layout.suit.magnifier then
>>      client.focus = awful.mouse.client_under_pointer()
>>    end
>>  end)
>>
>> which focuses the client under the pointer unless the layout is magnifier 
>> (it's
>> just annoying there because you have to keep the pointer in the center window
>> at all times and it wouldn't yield any benefits there)
>
> Perfect! This is what I was wanting to see!

Or almost this :-)

I am trying to use both this snippets in
awful.hooks.arrange.register(function (screen):

    -- Focus on the window where the mouse is
    client.focus = awful.mouse.client_under_pointer()

and

    -- Give focus to the latest client in history if no window has focus
    -- or if the current window is a desktop or a dock one.
    if not client.focus then
        local c = awful.client.focus.history.get(screen, 0)
        if c then client.focus = c end
    end

I am using them like this (and something says that it's wrong, but it
seems to works):

awful.hooks.arrange.register(function (screen)
    -- Give focus to the latest client in history if no window has focus
    -- or if the current window is a desktop or a dock one.
    if not client.focus then
        local c = awful.client.focus.history.get(screen, 0)
        if c then client.focus = c end
    end
    -- Focus on the window where the mouse is
    client.focus = awful.mouse.client_under_pointer()
end)

But I get this message every time:

W: awesome: luaA_dofunction:317: error running function:
/home/naoliv/.config/awesome/rc.lua:414: bad argument #3 to '?'
(client expected, got nil)

Also, new windows doesn't get the focus if the mouse is already over a
window. How can I give focus to newly created windows, please?

Thank you!

Best regards,
Nelson

--
To unsubscribe, send mail to [email protected].

Reply via email to