Search code examples
awesome-wm

AwesomeWM tag with static layout


StackOverflow is denoted as a place for AwesomeWM community support.

I would like to have a dedicated Tag in my AwesomeWM config where only three particular application will be running all the time. I managed to create new tag using sample config, and I managed to filer the applications using awful.rules.rules and place them into the tag.

I am experiencing troubles in understanding how AwesomeWM layout engine really works. I would like to achieve the following: three static columns of fixed widths, each application is located at its own column, when focus changes then no rearrangement happens, when any application is not running, then its reserved place is remain empty.

___________________
|   |       |     |
|   |       |     |
| A |   B   |  C  |
|   |       |     |
|   |       |     |
___________________

How do I specify layout in such case? Should I write my own one? Can I use flexible layout and specify position for client? What is the recommended correct way to achieve my goal?


Solution

  • I am experiencing troubles in understanding how AwesomeWM layout engine really works

    A layout is a table with two entries:

    • name is a string containing, well, the name of the layout
    • arrange is a function that is called to arrange the visible clients

    So you really only need to write an arrange function that arranges clients in the way you want. The argument to this function is the result of awful.layout.parameters, but you really need to care about

    • .clients is a list of clients that should be arranged.
    • .workarea is the available space for the clients.
    • .geometries is where your layout writes back the assigned geometries of clients

    I would recommend to read some of the existing layouts to see how they work. For example, the max layout is as simple as:

    function(p)
        for _, c in pairs(p.clients) do
            p.geometries[c] = {
                x = p.workarea.x,
                y = p.workarea.y,
                width = p.workarea.width,
                height = p.workarea.height
            }
        end
    end
    

    Should I write my own one? Can I use flexible layout and specify position for client?

    Well, the above is the write-own-layout approach. Alternatively, you could also make your clients floating and assign them a geometry via awful.rules. Just have properties = { floating = true, geometry = { x = 42, y = 42, width = 42, height = 42 } }. However, with this you could e.g. accidentally move one of your clients.

    What is the recommended correct way to achieve my goal?

    Pick one. there is no "just one correct answer".