我希望从任何未平铺的窗口中移除边框(无论它最大化的位置还是仅分配给标记的单个窗口),并在其获得平铺后立即添加边框,同时使用相同的布局。
我尝试了这个解决方案(将client.add_signal更改为client.connect_signal):http://blog.lazut.in/2012/11/awesome-wm-remove-border-from-maximized.html
client.connect_signal("focus",
function(c)
if c.maximized_horizontal == true and c.maximized_vertical == true then
c.border_width = "0"
c.border_color = beautiful.border_focus
else
c.border_width = beautiful.border_width
c.border_color = beautiful.border_focus
end
end)
但它只适用于一些最大化的窗口,并通过awful.rules.rules中的属性覆盖了我删除的边框(例如用于突触启动器)。
我看到了官方真棒API文档中列出的tiled(screen)
函数,也许可以用它做点什么?我还是Awesome WM的新手,所以一点帮助都会受到赞赏。
答案 0 :(得分:2)
这就是我在rc.lua中获得相同结果的原因:
for s = 1, screen.count() do
screen[s]:connect_signal("arrange", function ()
local clients = awful.client.visible(s)
local layout = awful.layout.getname(awful.layout.get(s))
-- No borders with only one visible client or in maximized layout
if #clients > 1 and layout ~= "max" then
for _, c in pairs(clients) do -- Floaters always have borders
if not awful.rules.match(c, {class = "Synapse"}) and awful.client.floating.get(c) or layout == "floating" then
c.border_width = beautiful.border_width
c.border_color = beautiful.border_focus
end
end
end
end)
end
我添加了条件if not awful.rules.match(c, {class = "Synapse"})...
来处理您指定的synapse启动器案例。但它可能已被其他条件覆盖(发射器应该已经浮动,因此下一个条件不允许它获得边界)
答案 1 :(得分:2)
令人敬畏的4.0,标题栏比窗口边框提供更多灵活性。 我使用标题栏来创建顶部和左侧边框。这样,我有边框来区分平铺模式下的客户端,但我仍然可以将鼠标移动到屏幕的右边缘或底边缘,然后单击滚动条。这也有助于我说明哪个是专注的客户。
以下是theme.lua
的一部分,我在其中定义了theme.bar_width
:
-- {{{ Borders
theme.useless_gap = 0
theme.border_width = 0
theme.bar_width = 2
theme.border_normal = "#3F3F3F"
theme.border_focus = "#6F6F6F"
theme.border_marked = "#CC9393"
-- }}}
以下是我rc.lua
的两部分,我在其中定义了两个标题栏:
client.connect_signal("request::titlebars", function(c)
-- ...
-- The top bar
-- code was: awful.titlebar(c) : setup { ...
-- code became:
awful.titlebar(c, {
position = "top",
bg_normal = beautiful.border_normal,
bg_focus = beautiful.border_focus,
}):setup{
-- ...
}
-- The left bar
awful.titlebar(c, {
position = "left",
size = beautiful.bar_width,
bg_normal = beautiful.border_normal,
bg_focus = beautiful.border_focus,
})
-- ...
end)
答案 2 :(得分:2)
这是我的Awesome 4.2版本:
screen.connect_signal("arrange", function (s)
local max = s.selected_tag.layout.name == "max"
local only_one = #s.tiled_clients == 1 -- use tiled_clients so that other floating windows don't affect the count
-- but iterate over clients instead of tiled_clients as tiled_clients doesn't include maximized windows
for _, c in pairs(s.clients) do
if (max or only_one) and not c.floating or c.maximized then
c.border_width = 0
else
c.border_width = beautiful.border_width
end
end
end)
我相信它可以正确处理最大化的窗口,在布局中唯一可见的窗口以及“最大”布局中的窗口。它还会忽略浮动客户端。