From 3f0050c6152c5877a1fde347aa3e52565e615215 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 23 Jul 2015 10:54:38 -0300 Subject: Signals and rules in separate files --- config.dot/awesome.link/rc.lua | 64 +++---------------------------------- config.dot/awesome.link/rules.lua | 28 ++++++++++++++++ config.dot/awesome.link/signals.lua | 30 +++++++++++++++++ 3 files changed, 63 insertions(+), 59 deletions(-) create mode 100644 config.dot/awesome.link/rules.lua create mode 100644 config.dot/awesome.link/signals.lua diff --git a/config.dot/awesome.link/rc.lua b/config.dot/awesome.link/rc.lua index c968519..8520d00 100644 --- a/config.dot/awesome.link/rc.lua +++ b/config.dot/awesome.link/rc.lua @@ -356,67 +356,13 @@ clientbuttons = awful.util.table.join( root.keys(globalkeys) -- }}} --- {{{ Rules -awful.rules.rules = { - -- All clients will match this rule. - { rule = { }, - properties = { border_width = beautiful.border_width, - border_color = beautiful.border_normal, - focus = true, - keys = clientkeys, - buttons = clientbuttons } }, - { rule = { class = "MPlayer" }, - properties = { floating = true } }, - { rule = { class = "pinentry" }, - properties = { floating = true } }, - { rule = { class = "gimp" }, - properties = { floating = true } }, - -- Size hint - -- See https://superuser.com/questions/347001/how-can-i-force-gvim-in-awesome-to-fill-the-screen - { rule = { class = "Gvim" }, - properties = { size_hints_honor = false } }, - { rule = { class = "XTerm" }, - properties = { size_hints_honor = false } }, - { rule = { class = "URxvt" }, - properties = { size_hints_honor = false } }, - -- Set Firefox to always map on tags number 2 of screen 1. - -- { rule = { class = "Firefox" }, - -- properties = { tag = tags[1][2] } }, -} --- }}} +-- Rules +dofile(configdir .. "/rules.lua") --- {{{ Signals --- Signal function to execute when a new client appears. -client.add_signal("manage", function (c, startup) - -- Add a titlebar - -- awful.titlebar.add(c, { modkey = modkey }) - - -- Enable sloppy focus (focus on mouse over) - --c:add_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 then - -- Set the windows at the slave, - -- i.e. put it at the end of others instead of setting it master. - -- awful.client.setslave(c) - - -- Put windows in a smart way, only if they does not set an initial position. - if 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 -end) - -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) --- }}} +-- Signals +dofile(configdir .. "/signals.lua") --- Key mappings +-- Custom key mappings dofile(configdir .. "/keys.lua") -- Startup commands diff --git a/config.dot/awesome.link/rules.lua b/config.dot/awesome.link/rules.lua new file mode 100644 index 0000000..493cc4a --- /dev/null +++ b/config.dot/awesome.link/rules.lua @@ -0,0 +1,28 @@ +-- {{{ Rules +awful.rules.rules = { + -- All clients will match this rule. + { rule = { }, + properties = { border_width = beautiful.border_width, + border_color = beautiful.border_normal, + focus = true, + keys = clientkeys, + buttons = clientbuttons } }, + { rule = { class = "MPlayer" }, + properties = { floating = true } }, + { rule = { class = "pinentry" }, + properties = { floating = true } }, + { rule = { class = "gimp" }, + properties = { floating = true } }, + -- Size hint + -- See https://superuser.com/questions/347001/how-can-i-force-gvim-in-awesome-to-fill-the-screen + { rule = { class = "Gvim" }, + properties = { size_hints_honor = false } }, + { rule = { class = "XTerm" }, + properties = { size_hints_honor = false } }, + { rule = { class = "URxvt" }, + properties = { size_hints_honor = false } }, + -- Set Firefox to always map on tags number 2 of screen 1. + -- { rule = { class = "Firefox" }, + -- properties = { tag = tags[1][2] } }, +} +-- }}} diff --git a/config.dot/awesome.link/signals.lua b/config.dot/awesome.link/signals.lua new file mode 100644 index 0000000..c65409f --- /dev/null +++ b/config.dot/awesome.link/signals.lua @@ -0,0 +1,30 @@ +-- {{{ Signals +-- Signal function to execute when a new client appears. +client.add_signal("manage", function (c, startup) + -- Add a titlebar + -- awful.titlebar.add(c, { modkey = modkey }) + + -- Enable sloppy focus (focus on mouse over) + --c:add_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 then + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Put windows in a smart way, only if they does not set an initial position. + if 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 +end) + +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) +-- }}} -- cgit v1.2.3