在 Awesome-wm 中为特定应用程序设置窗口布局
如何配置很棒,以便它可以启动两个窗口对齐的新应用程序,如下所示:
----------------
|xxxxxxxxxx####|
|xxxxxxxxxx####|
|xxxxxxxxxx####|
|xxxxxxxxxx####|
----------------
其中“x”是 pidgin 中的对话窗口,“#”是好友列表窗口。
一般来说,我想指定右窗口的宽度并将其放在右侧(垂直最大化),另一个窗口应该占用剩余空间。
我已经有了一些几乎可以工作的代码,但它的行为很奇怪(它为 pidgin 设置了所有正确的内容,但对于 gimp 和 v_sim 则不然,有时在没有任何我所知的原因的情况下它会改变左窗口的几何形状。或者当我启动应用程序(v_sim)它没有放置在正确的位置,并且没有垂直最大化,但是当我重新启动时,它会正确放置它,所以我猜这个应用程序在启动时会改变一些东西,
这是我的代码。现在使用:
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
},
...
}
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
},
...
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了完全相同的问题,但我想要左侧有一个大的 Firefox 窗口,右侧有一个小终端。为了让它工作,我专门为此目的使用了一个带有平铺左侧布局的标签,并调整了宽度系数(即通常由 CTRL-L 执行的操作)。
将以下内容添加到 rc.lua 的末尾,其中 yourtag 是您要在其中放置这些窗口的标签。 0.15 值可以根据您的喜好进行调整。
此外,对右侧所需的窗口使用
awful.client.setslave
可确保它们不会被切换。您还可以使用
tag
属性将某些应用程序定向到标记。然后,我创建了一个绑定来打开这些应用程序,如下所示。
这是最终结果:
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.
Also, using the
awful.client.setslave
for the window that you want on the right ensures that they don't get switched.You may also direct certain applications to a tag using the
tag
property.I then created a binding to open these applications as follows.
This is the final result:
或者,您可以使用带有 struts 的浮动联系人列表窗口。
这可以防止在不存在消息窗口时联系人列表窗口最大化。
此外,它还允许将 CL 窗口放置在任意(平铺)窗口旁边。
查看:http://www.bramschoenmakers.nl/en/node/738
对于我的版本来说,他的实现有点错误。
问题是它不会针对已经设置的支柱进行调整。
我的实现:
这将 CL 窗口放在左侧并为其分配固定空间。
(对话窗口不需要任何规则)
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:
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)