Setting windows layout for a specific application in awesome-wm

﹥>﹥吖頭↗ 提交于 2019-12-02 17:40:49

I had this exact same problem, but I wanted a large Firefox window on the left with a small terminal on the right. To get it to work I dedicated a tag for this purpose with a tile-left layout and adjusted the width factor (i.e. the operation normally performed by CTRL-L).

Add the following to the end of rc.lua where yourtag is the tag in which you would like to place these windows. The 0.15 value can be adjusted to your taste.

awful.tag.viewonly(yourtag)
awful.tag.incmwfact(0.15, yourtage)

Also, using the awful.client.setslave for the window that you want on the right ensures that they don't get switched.

{
    rule = { class = "URxvt" },
    callback = awful.client.setslave
},

You may also direct certain applications to a tag using the tag property.

{
    rule = { class = "Firefox" },
    properties = { tag = browse }
},
{
    rule = { class = "URxvt", instance = "browse" },
    properties = { tag = browse },
},

I then created a binding to open these applications as follows.

-- Custom programs
awful.key({ modkey, "Shift" }, "b", function()
    awful.tag.viewonly(browse)
    awful.util.spawn_with_shell("urxvt -name browse -e newsbeuter")
    awful.util.spawn("firefox")
end)

This is the final result:

Alternatively, you can use a floating contact list window with struts. This prevents the contact list window from being maximized when no message-window is present. Also, it allows the CL-window to be placed next to arbitrary (tiling) windows.

Check out: http://www.bramschoenmakers.nl/en/node/738

Although his implementation is a bit buggy for my version of awesome. The problem is that it does not adjust for struts that have already been set.

My implementation:

{ rule = { class = "Pidgin", role = "buddy_list" },
    properties = {floating=true,
                  maximized_vertical=true, maximized_horizontal=false },
    callback = function (c)
        local cl_width = 250    -- width of buddy list window

        local scr_area = screen[c.screen].workarea
        local cl_strut = c:struts()

        -- scr_area is affected by this client's struts, so we have to adjust for that
        if c:isvisible() and cl_strut ~= nil and cl_strut.left > 0 then
            c:geometry({x=scr_area.x-cl_strut.left, y=scr_area.y, width=cl_strut.left})
        -- scr_area is unaffected, so we can use the naive coordinates
        else
            c:struts({left=cl_width, right=0})
            c:geometry({x=scr_area.x, y=scr_area.y, width=cl_width})
        end
    end },

This puts the CL window on the left and allocating a fixed space for it.

(You don't need any rule for the conversation-window)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!