I am running a script which creates and closes several windows, hence, I added to my rc.lua a way to keep the window where I am working always on top:
awful.key({ modkey, "Control" }, "space",
function(c)
awful.client.floating.toggle()
c.ontop = not c.ontop
end),
The problem is:when the new window is created, I lose the focus, which passes to the new window.
Is there a way to make that the previous toggle not only keep the window on top, but also with the focus until I toggle it again?
Assuming the awful.rules.rules
assignment from lines 357-375 of this awesomerc.lua file are in your user's awesomerc.lua
file and the awful.client.focus.filter
used in that assignment is the one from this file then you should be able to do something like this.
Define a custom focus filter function somewhere in your rc file.
function custom_focus_filter(c)
if global_focus_disable then
return nil
end
return awful.client.focus.filter(c)
end
Then use that custom filter function in the rules assignment in place of the original filter function.
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { ....
focus = custom_focus_filter,
.... } },
And then your toggle function just needs to set and unset the global as appropriate.
awful.key({ modkey, "Shift" }, "f", function ()
global_focus_disable = not global_focus_disable
end)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With