Search code examples
multiple-monitorsawesome-wm

How do I maximize the window to multiple monitors in awesome wm?


I have three monitors in a horizontal line. Sometimes i want to maximize a window to three monitors at once, by pressing a combination of keys (and then returning it all back if necessary). How can I do that?


Solution

  • Untested, but the basic idea is to make the window floating and resize it to cover everything:

    function(c)
        c.floating = true
        local geo = screen[1].geometry
        geo.x2 = geo.x + geo.width
        geo.y2 = geo.y + geo.height
        for s in screen do
            local geo2 = s.geometry
            geo.x = math.min(geo.x, geo2.x)
            geo.y = math.min(geo.y, geo2.y)
            geo.x2 = math.max(geo.x2, geo2.x + geo2.width)
            geo.y2 = math.max(geo.y2, geo2.y + geo2.height)
        end
        c:geometry{
            x = geo.x,
            y = geo.y,
            width = geo.x2 - geo.x,
            height = geo.y2 - geo.y
        }
    end
    

    To undo the above, make the client no longer floating, i.e. c.floating = false.

    Wiring the above to a keybinding is left as an exercise for the reader.