Always on the top window and focusing on AwesomeWM

I run a script that creates and closes several windows, so I added to my rc.lua a way to save the window, where I always work from above:

awful.key({ modkey, "Control" }, "space", function(c) awful.client.floating.toggle() c.ontop = not c.ontop end), 

Problem: when I create a new window, I lose focus, which switches to a new window.

Is there a way to make the previous switch not only hold the window from above, but also with focus until I switch it again?

+5
source share
1 answer

Assuming the destination awful.rules.rules from lines 357-375, this awesomerc.lua file is in your custom awesomerc.lua file, and the awful.client.focus.filter used in this destination is that of 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 the custom filter function in the rule assignment instead of the original filter function.

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

And then your switch function just needs to set and disable global if necessary.

 awful.key({ modkey, "Shift" }, "f", function () global_focus_disable = not global_focus_disable end) 
+3
source

All Articles