如何专注于特定的客户端窗口

时间:2016-08-28 15:40:08

标签: awesome-wm

如何通过按Alt-1到第一个窗口,Alt-2转到第二个窗口等,将我的注意力集中在真棒窗口管理器中的特定客户端上?我制作了这个剧本,但它没有正常工作,它选择随机窗口:

awful.key({"Mod1"            }, "1",
    function ()
        awful.client.focus.byidx(1)
        if client.focus then
            client.focus:raise()
        end
    end         ),
awful.key({"Mod1"            }, "2",
    function ()
        awful.client.focus.byidx(2)
        if client.focus then
            client.focus:raise()
        end
    end         ),
awful.key({"Mod1"            }, "3",
    function ()
        awful.client.focus.byidx(3)
        if client.focus then
            client.focus:raise()
        end
    end         ),

1 个答案:

答案 0 :(得分:4)

适用于3.5.6

awful.key({"Mod1"            }, "2",
    function ()
        local cc = {}
        for _, c in ipairs(client.get()) do
            if awful.widget.tasklist.filter.currenttags(c, mouse.screen) then cc[#cc + 1] = c end
        end
        local new_focused = cc[2]
        if new_focused then client.focus = new_focused; new_focused:raise() end
    end
),