Search code examples
functionluaawesome-wm

awesomewm: a function to move all open clients to their designated screens/tags


Reading on the use of mod + x: run lua code I wanted to insert a function in my rc.lua that would move all opened clients (back) to their screens and tags. Everytime I take my laptop out of the docking the windows end up on one screen on the first tag, so If I could restore them running a function, that would save me a lot of time.

But... I have no experience in LUA at all, so I tried this

shuffle = function(...)
    clientlist = {}
    for i, c in ipairs(client.get()) do
        -- assign tag
        -- c:tags (tag)
        -- c:move_to_screen ([s=c.screen.index+1])
        table.insert(clientlist,c.name)
        naughty.notify{c.name}    
    end
    naughty.notify{table.concat(clientlist,'\n')}
end

When I run this, I get a number of notifications, that respond to the number of open clients + 1, but there is nothing in them. What am I doing wrong ?

Also, is there an easier way to debug this, instead of using the notify box ?


Solution

  • The answer to the question that you are actually asking is: You need naughty.notify{ title = c.name }.