2016-09-26 24 views
1

在令人敬畏的WM中,我使用gmrun,一個小型應用程序啓動器。令人敬畏的WM,爲應用程序保持焦點異常

{ 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

創建自定義焦點過濾功能

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 }, 

Additioally,你可能需要在你的配置編輯每一個地方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), 
    .... 
+0

OK這工作正常 – jods

相關問題