真棒wm,保持应用程序的焦点异常

时间:2016-09-26 17:50:43

标签: lua awesome-wm

非常棒的我使用gmrun,一个小型应用程序启动器。

{ rule = { class = "Gmrun" },
  properties = { floating = true, ontop = true, focus = true }, callback = function(c) c:geometry({x=30, y=45}) end},

这是我对所有客户部分的规则

awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
  properties = { border_width = beautiful.border_width,
                 border_color = beautiful.border_normal,
                 focus = awful.client.focus.filter,
                 raise = true,
                 keys = clientkeys,
                 size_hints_honor = false,
                 buttons = clientbuttons }, callback = awful.client.setslave },

我希望gmrun始终保持专注(规则上的例外,通常新开放的客户端获得焦点) 我已阅读此页面,但未找到解决方案, Always-on-top window and keeping focus, on AwesomeWM提前致谢

1 个答案:

答案 0 :(得分:1)

创建自定义焦点过滤功能

local free_focus = true
local function custom_focus_filter(c) return free_focus and awful.client.focus.filter(c) end

修改主要规则

awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
      properties = { ....
                     focus = custom_focus_filter,
                     .... } },

和gmrun规则

{ rule = { class = "Gmrun" },
  properties = { floating = true, ontop = true, focus = true },
  callback = function(c)
      c:geometry({x=30, y=45})
      free_focus = false
      c:connect_signal("unmanage", function() free_focus = true end)
  end },

另外,您可能需要修改配置中使用client.focus =的每个位置(例如草率焦点,客户端按钮)。例如

clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) if custom_focus_filter(c) then client.focus = c; c:raise() end end),
    ....