--[[
This modification to the manage and focus hooks in
awesome git allow you to emulate the border behavior
found in the new dwm 5.4.1 release. If there is only
one (((tiled))) client on the tag, remove the border
in order to save space. (I myself use 3px borders.)
As it's quite obvious which client has focus, this
allows you to possibly fit in one more row for a
terminal that takes up the whole screen, making it
a mutant form of the max layout.
The only special check to do with this is if the
new window is a floating window. If it floats it
gets a border. (same as in dwm) That way you can
still tell which floating window has focus, and you
tell if the tiled one is focused by all the floating
windows having the "normal" border color. In that
respect it's process of elimination to discern focus.
This is so that when you open a floating "Save as..."
window in Firefox it won't give the floating window a
border along with the firefox window.
I used to have it check for how many visable windows,
but when opening a floating window in Firefox I hated
how it would add the border to the *one* tiled window
causing everything to shift over slightly. I think
only adding the border to the floating if there is only
one tiled window is a better decision. It also keeps
the feature parity with dwm.
Icky bit: As you can see, in the manage hook I create
the "tiledclients" table and then do a "foreach" loop of
that. This seems inefficient to me as that would only be
done when the new window is the second tiled window on the
layout. If there is a way to just say "the only other tiled
window, give that one focus", I would certainly love to learn
of it. the for key,value loop works, and only loops the 2
times needed for this behavior, but it seems like a slight
overkill syntactically. I hope for a simpler way. Like maybe
awful.client.byidx().... or something I haven't yet looked at
that.
Hope you enjoy...
]]
-- This is my entire awful.hooks.focus.register()
awful.hooks.focus.register(
function (c)
if awful.client.floating.get(c) == true then
c.border_width = beautiful.border_width
c.border_color = beautiful.border_focus
else
if #awful.client.tiled(mouse.screen) == 1 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
end
)
-- This is the section that I changed in my awful.hooks.manage.register()
awful.hooks.manage.register(
-- ....
-- Set a visible border only if there is more than one visable client.
if awful.client.floating.get(c) == true then
c.border_width = beautiful.border_width
c.border_color = beautiful.border_normal
else
local tiledclients = awful.client.tiled(mouse.screen)
if #tiledclients == 1 then
c.border_width = 0
c.border_color = beautiful.border_normal
else
for unused, current in pairs(tiledclients) do
current.border_width = beautiful.border_width
current.border_color = beautiful.border_normal
end
end
end
-- c.border_width = beautiful.border_width
-- c.border_color = beautiful.border_normal
-- ....
)
-- PS: Sorry my emails are so long. >.< I'm not normally this talkative.
--
To unsubscribe, send mail to [email protected].