From f4e09a066c869aa2c69a71de23a2f5ec80fbfdb0 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Mon, 9 Nov 2009 00:28:14 +0100 Subject: rc.lua: make use of the arrange signal Added fine grained border and floater controls. Code adds a titlebar and border to each floating client (also covers floating layout), and makes it ontop. In case there is only one tiled client visible or we are in max layout the border is removed to save space. Next commit will revert the change, because I don't intend to use it at this moment but I'm placing it here for archival and reference. --- rc.lua | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) (limited to 'rc.lua') diff --git a/rc.lua b/rc.lua index 94c1917..48fa6b5 100644 --- a/rc.lua +++ b/rc.lua @@ -443,17 +443,13 @@ clientkeys = awful.util.table.join( awful.key({ modkey }, "Up", function () awful.client.moveresize(0, -20, 0, 0) end), awful.key({ modkey }, "Left", function () awful.client.moveresize(-20, 0, 0, 0) end), awful.key({ modkey }, "Right", function () awful.client.moveresize(20, 0, 0, 0) end), + awful.key({ modkey, "Shift" }, "f", function (c) awful.client.floating.toggle(c) end), awful.key({ modkey, "Shift" }, "m", function (c) c:swap(awful.client.getmaster()) end), awful.key({ modkey, "Shift" }, "c", function (c) exec("kill -CONT " .. c.pid) end), awful.key({ modkey, "Shift" }, "s", function (c) exec("kill -STOP " .. c.pid) end), awful.key({ modkey, "Shift" }, "t", function (c) if c.titlebar then awful.titlebar.remove(c) else awful.titlebar.add(c, { modkey = modkey }) end - end), - awful.key({ modkey, "Shift" }, "f", function (c) awful.client.floating.toggle(c) - if awful.client.floating.get(c) - then c.above = true; awful.titlebar.add(c); awful.placement.no_offscreen(c) - else c.above = false; awful.titlebar.remove(c) end end) ) -- }}} @@ -538,18 +534,8 @@ awful.rules.rules = { -- {{{ Signals -- --- {{{ Signal function to execute when a new client appears +-- {{{ Manage signal handler client.add_signal("manage", function (c, startup) - -- Add a titlebar to each floating client - if awful.client.floating.get(c) - or awful.layout.get(c.screen) == awful.layout.suit.floating then - if not c.titlebar and c.class ~= "Xmessage" then - awful.titlebar.add(c, { modkey = modkey }) - end - -- Floating clients are always on top - c.above = true - end - -- Enable sloppy focus c:add_signal("mouse::enter", function (c) if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier @@ -577,8 +563,37 @@ client.add_signal("manage", function (c, startup) end) -- }}} --- {{{ Focus signal functions +-- {{{ Focus signal handlers client.add_signal("focus", function (c) c.border_color = beautiful.border_focus end) client.add_signal("unfocus", function (c) c.border_color = beautiful.border_normal end) -- }}} + +-- {{{ Arrange signal handler +for s = 1, screen.count() do screen[s]:add_signal("arrange", function () + local clients = awful.client.visible(s) + local layout = awful.layout.getname(awful.layout.get(s)) + + if #clients > 0 then -- Fine grained borders and floaters control + for _, c in pairs(clients) do -- Floaters always have borders + if awful.client.floating.get(c) or layout == "floating" then + c.border_width = beautiful.border_width + + if not c.fullscreen then -- Floaters have titlebars + if not c.titlebar and c.class ~= "Xmessage" then + awful.titlebar.add(c, { modkey = modkey }) + end -- Floaters are always on top + c.above = true + end + + -- No borders with only one visible client + elseif #clients == 1 or layout == "max" then + clients[1].border_width = 0 + else + c.border_width = beautiful.border_width + end + end + end + end) +end +-- }}} -- }}} -- cgit v1.2.3