How to hide borders dynamically from windows when not tiled (awesome wm)?
I would like to remove the border from any window that is not tiled (no matter where it is maximized, or just one window assigned to a tag) and add borders as soon as they become tiled, using the same layout.
I tried this solution (with changing client.add_signal to 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)
but it only worked in some maximized windows and overwrote the borders I removed (for synapse launcher for example) via properties in awful.rules.rules.
I saw the function tiled(screen)
mentioned in the official API documentation, maybe something can be done about it? I'm still new to Awesome WM, so a little help would be appreciated.
source to share
This is what I have in my rc.lua to achieve the same result:
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
I added a condition if not awful.rules.match(c, {class = "Synapse"})...
to handle the synapse trigger case you specified. But this may already be covered by other conditions (the launcher must already be floating, so the next condition will not allow it to get the border)
source to share
With the stunning 4.0, headers have more flexibility than window borders. I am using a header to create the top and left borders. This way I have borders to distinguish clients in tiled mode, but I can still place my mouse on the right or bottom edge of the screen and click on the scroll bar. It also helps me determine who the focused customer is.
Here is a snippet of mine theme.lua
where I define 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" -- }}}
And here are two parts from mine rc.lua
where I define two header bars:
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)
source to share