Search code examples
awesome-wm

How to get a signal when layout has changed in Awesome Wm


Is is possible to capture the layout change in Awesome 3.5 like this for the tags ( for example):

screen[s]:connect_signal("tag::history::update", function()                     
   --do some stuff when virtual desktop has changed
end

If so how do you do it?


Solution

  • When the layout of a tag is changed, awful.layout.set just calls awful.tag.setproperty to set the "layout" property of the tag. This will then emit the "property::layout" signal on the tag.

    Here is how to connect to this signal for any tag (only works in awesome 3.5, not 3.4):

    tag.connect_signal("property::layout", function(t)
        print("Layout of tag " .. t.name .. " is now function " .. awful.tag.getproperty(t, "layout"))
    end)
    

    For a specific tag object t, you can also use the following code. This will only run when the layout of just that tag changes.

    t:connect_signal("property::layout", function() print("Layout changed") end)