Setting windows layout for a specific application in awesome-wm
Solution 1
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:
Solution 2
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)
Related videos on Youtube
klew
Updated on October 27, 2020Comments
-
klew over 3 years
How to config awesome so it would start new application with two windows aligned like this:
---------------- |xxxxxxxxxx####| |xxxxxxxxxx####| |xxxxxxxxxx####| |xxxxxxxxxx####| ----------------
where "x" is for example conversation window in pidgin and '#' is buddy list window.
In general I would like to specify width of right window and put it on the right side (maximized vertically) and the other window should take the remaining space.
I already have some almost-working code, but it behaves strangely (it setups everything correct for pidgin, but it doesn't for gimp and v_sim, and occasionally without any known to me reason it changes geometry of the left window. Or when I start application (v_sim) it isn't placed in correct positions and it isn't maximized vertically, but when I then restart awesome, it places it correctly. So I guess that this application changes something when it starts.
Here is code which I use now:
awful.rules.rules = { ... { rule = { class = "Pidgin", role = "buddy_list" }, properties = { floating = true }, callback = function( c ) local w_area = screen[ c.screen ].workarea local winwidth = 340 c:struts( { right = winwidth } ) c:geometry( { x = w_area.width - winwidth, width = winwidth, y = w_area.y, height = w_area.height } ) end }, { rule = { class = "Pidgin", role = "conversation" }, properties = { floating = true, x = 0, maximized_vertical = true, maximized_horizontal = true }, callback = awful.client.setslave }, ... }
-
Łukasz Gruner about 13 yearswhy would you even want to make those windows float? just use a proper layout manager, and add a callback to one of those windows to set it as master.
-
Łukasz Gruner about 13 yearsSetting window as master would just put it into 'master' part of the layout (default shortcut for this is 'mod+enter'), if you use, for example tiling layout, you coud have the master part take 30% of the space, put your roster there, and all the chat windows would go to the 'slave' part. If you than add a rule for that 'tag' that says 'give all windows except pidgin float attribute' it would behave like you want it to.
-
-
coldfix almost 12 yearsIf you have pidgin-extprefs installed, you should make sure, to enable the option "Allow buddy list to shrink below normal constraints". Otherwise you must define
size_hints_honor=false
in the properties (or pidgin behaves really weird). Also, usingsetmwfact(..)
is probably a better choice thanincmwfact(..)