In awesome wm I use gmrun, a small application launcher.
{ rule = { class = "Gmrun" },
properties = { floating = true, ontop = true, focus = true }, callback = function(c) c:geometry({x=30, y=45}) end},
and this is my rules for all clients section
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 },
I would like gmrun to always keep focus (an exception on the rule, normally the new opened client gets the focus) I 've read this page, but didn't find the solution, Always-on-top window and keeping focus, on AwesomeWM Thanks in advance
Create custom focus filter function
local free_focus = true
local function custom_focus_filter(c) return free_focus and awful.client.focus.filter(c) end
Edit your main rule
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { ....
focus = custom_focus_filter,
.... } },
and gmrun rule
{ 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, you may need to edit every place in your config where client.focus =
used (eg sloppy focus, client buttons). For example
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) if custom_focus_filter(c) then client.focus = c; c:raise() end end),
....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.