diff --git a/myrc/signals.lua b/myrc/signals.lua new file mode 100644 index 0000000..e851b10 --- /dev/null +++ b/myrc/signals.lua @@ -0,0 +1,56 @@ +local awful = require("awful") +local beautiful = require("beautiful") + +-- {{{ Signals +-- Signal function to execute when a new client appears. +client.connect_signal("manage", function (c, startup) + -- Enable sloppy focus + c:connect_signal("mouse::enter", function(c) + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end + end) + + if not startup and not c.size_hints.user_position + and not c.size_hints.program_position then + awful.placement.no_overlap(c) + awful.placement.no_offscreen(c) + end +end) + +-- No border for maximized clients +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_normal + else + c.border_width = beautiful.border_width + c.border_color = beautiful.border_focus + end + end) +client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) +-- }}} + +-- {{{ Arrange signal handler +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)) + + 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 + + -- 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 +-- }}} diff --git a/rc.lua.blackburn b/rc.lua.blackburn index 49bd70b..4446078 100644 --- a/rc.lua.blackburn +++ b/rc.lua.blackburn @@ -530,56 +530,5 @@ root.keys(globalkeys) -- Rules require("settings.rules") --- {{{ Signals --- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c, startup) - -- Enable sloppy focus - c:connect_signal("mouse::enter", function(c) - if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier - and awful.client.focus.filter(c) then - client.focus = c - end - end) - - if not startup and not c.size_hints.user_position - and not c.size_hints.program_position then - awful.placement.no_overlap(c) - awful.placement.no_offscreen(c) - end -end) - --- No border for maximized clients -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_normal - else - c.border_width = beautiful.border_width - c.border_color = beautiful.border_focus - end - end) -client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) --- }}} - --- {{{ Arrange signal handler -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)) - - 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 - - -- 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 --- }}} +-- Signals +require("myrc.signals") diff --git a/rc.lua.dremora b/rc.lua.dremora index 0179cb3..3e24a82 100644 --- a/rc.lua.dremora +++ b/rc.lua.dremora @@ -530,85 +530,5 @@ root.keys(globalkeys) -- Rules require("settings.rules") --- {{{ Signals --- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c, startup) - -- Enable sloppy focus - c:connect_signal("mouse::enter", function(c) - if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier - and awful.client.focus.filter(c) then - client.focus = c - end - end) - - if not startup and not c.size_hints.user_position - and not c.size_hints.program_position then - awful.placement.no_overlap(c) - awful.placement.no_offscreen(c) - end - - local titlebars_enabled = true - if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then - -- buttons for the titlebar - local buttons = awful.util.table.join( - awful.button({ }, 1, function() - client.focus = c - c:raise() - awful.mouse.client.move(c) - end), - awful.button({ }, 3, function() - client.focus = c - c:raise() - awful.mouse.client.resize(c) - end) - ) - - -- Title in the middle - local middle_layout = wibox.layout.flex.horizontal() - local title = awful.titlebar.widget.titlewidget(c) - title:set_align("center") - middle_layout:add(title) - middle_layout:buttons(buttons) - - local layout = wibox.layout.align.horizontal() - layout:set_middle(middle_layout) - - awful.titlebar(c,{size=18}):set_widget(layout) - end -end) - --- No border for maximized clients -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_normal - else - c.border_width = beautiful.border_width - c.border_color = beautiful.border_focus - end - end) -client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) --- }}} - --- {{{ Arrange signal handler -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)) - - 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 - - -- 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 --- }}} +-- Signals +require("myrc.signals") diff --git a/rc.lua.holo b/rc.lua.holo index 357ed27..571cdad 100644 --- a/rc.lua.holo +++ b/rc.lua.holo @@ -665,56 +665,5 @@ root.keys(globalkeys) -- Rules require("settings.rules") --- {{{ Signals --- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c, startup) - -- Enable sloppy focus - c:connect_signal("mouse::enter", function(c) - if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier - and awful.client.focus.filter(c) then - client.focus = c - end - end) - - if not startup and not c.size_hints.user_position - and not c.size_hints.program_position then - awful.placement.no_overlap(c) - awful.placement.no_offscreen(c) - end -end) - --- No border for maximized clients -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_normal - else - c.border_width = beautiful.border_width - c.border_color = beautiful.border_focus - end - end) -client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) --- }}} - --- {{{ Arrange signal handler -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)) - - 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 - - -- 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 --- }}} +-- Signals +require("myrc.signals") diff --git a/rc.lua.multicolor b/rc.lua.multicolor index f933076..91dcca8 100644 --- a/rc.lua.multicolor +++ b/rc.lua.multicolor @@ -594,60 +594,5 @@ root.keys(globalkeys) -- Rules require("settings.rules") --- {{{ Signals --- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c, startup) - -- Enable sloppy focus - c:connect_signal("mouse::enter", function(c) - if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier - and awful.client.focus.filter(c) then - client.focus = c - end - end) - - if not startup and not c.size_hints.user_position - and not c.size_hints.program_position then - awful.placement.no_overlap(c) - awful.placement.no_offscreen(c) - end -end) - --- No border for maximized clients -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_normal - else - c.border_width = beautiful.border_width - c.border_color = beautiful.border_focus - end - end) -client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) --- }}} - --- {{{ Arrange signal handler -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)) - - if #clients > 0 then -- Fine grained borders and floaters control - for _, c in pairs(clients) do -- Floaters always have borders - -- No borders with only one humanly visible client - if layout == "max" then - c.border_width = 0 - elseif awful.client.floating.get(c) or layout == "floating" then - c.border_width = beautiful.border_width - elseif #clients == 1 then - clients[1].border_width = 0 - if layout ~= "max" then - awful.client.moveresize(0, 0, 2, 0, clients[1]) - end - else - c.border_width = beautiful.border_width - end - end - end - end) -end --- }}} +-- Signals +require("myrc.signals") diff --git a/rc.lua.powerarrow-darker b/rc.lua.powerarrow-darker index c32e580..ce55936 100644 --- a/rc.lua.powerarrow-darker +++ b/rc.lua.powerarrow-darker @@ -583,56 +583,5 @@ root.keys(globalkeys) -- Rules require("settings.rules") --- {{{ Signals --- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c, startup) - -- Enable sloppy focus - c:connect_signal("mouse::enter", function(c) - if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier - and awful.client.focus.filter(c) then - client.focus = c - end - end) - - if not startup and not c.size_hints.user_position - and not c.size_hints.program_position then - awful.placement.no_overlap(c) - awful.placement.no_offscreen(c) - end -end) - --- No border for maximized clients -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_normal - else - c.border_width = beautiful.border_width - c.border_color = beautiful.border_focus - end - end) -client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) --- }}} - --- {{{ Arrange signal handler -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)) - - 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 - - -- 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 --- }}} +-- Signals +require("myrc.signals") diff --git a/rc.lua.rainbow b/rc.lua.rainbow index 473268d..ff6efd0 100644 --- a/rc.lua.rainbow +++ b/rc.lua.rainbow @@ -528,56 +528,5 @@ root.keys(globalkeys) -- Rules require("settings.rules") --- {{{ Signals --- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c, startup) - -- Enable sloppy focus - c:connect_signal("mouse::enter", function(c) - if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier - and awful.client.focus.filter(c) then - client.focus = c - end - end) - - if not startup and not c.size_hints.user_position - and not c.size_hints.program_position then - awful.placement.no_overlap(c) - awful.placement.no_offscreen(c) - end -end) - --- No border for maximized clients -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_normal - else - c.border_width = beautiful.border_width - c.border_color = beautiful.border_focus - end - end) -client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) --- }}} - --- {{{ Arrange signal handler -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)) - - 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 - - -- 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 --- }}} +-- Signals +require("myrc.signals") diff --git a/rc.lua.steamburn b/rc.lua.steamburn index 87962b4..adce0d2 100644 --- a/rc.lua.steamburn +++ b/rc.lua.steamburn @@ -537,56 +537,5 @@ root.keys(globalkeys) -- Rules require("settings.rules") --- {{{ Signals --- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c, startup) - -- Enable sloppy focus - c:connect_signal("mouse::enter", function(c) - if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier - and awful.client.focus.filter(c) then - client.focus = c - end - end) - - if not startup and not c.size_hints.user_position - and not c.size_hints.program_position then - awful.placement.no_overlap(c) - awful.placement.no_offscreen(c) - end -end) - --- No border for maximized clients -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_normal - else - c.border_width = beautiful.border_width - c.border_color = beautiful.border_focus - end - end) -client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) --- }}} - --- {{{ Arrange signal handler -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)) - - 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 - - -- 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 --- }}} +-- Signals +require("myrc.signals")