如何在Awesome WM中绑定特定客户端类的客户端密钥?

时间:2017-12-22 14:52:37

标签: awesome-wm

我想绑定客户端密钥以仅在vivaldi浏览器中对Mod1-q快捷方式执行某些操作,因此我在clientkeys中的rc.lua配置中写入:

awful.key({"Mod1"}, "q",
function (c)
  if c.class == "Vivaldi-stable" then
    someoperation()
  end
end,
{description = "Some operation only in browser", group = "client"})

此代码的问题是,如果在someoperation()浏览器中按下Mod1+q,则执行vivaldi,但所有其他窗口根本没有输入,而我希望它们接收{ {1}}和以前一样。是否有一些明显的方法可以将密钥仅绑定到特定的客户端类,可能是通过Mod1+q函数?

1 个答案:

答案 0 :(得分:1)

将以下内容添加到合适的条目(class = "Vivaldi[-]stable")至awful.rules

callback = function(c)
    local keys = c:keys()
    c:keys(gears.table.join(keys,
        awful.key({"Mod1"}, "q", someoperation,
        { description = "Some operation only in browser", group = "client"})))
end