aboutsummaryrefslogtreecommitdiff
path: root/config.dot/awesome.link/signals.lua
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-07-12 15:45:45 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-07-12 15:45:45 -0300
commite5b5be048c087e04bd504d4c13a48317d7a45915 (patch)
treeb18e8b9e75c148fc4a353b5b1da15ca849a8ddc6 /config.dot/awesome.link/signals.lua
parent1d37c3c4cfd5c554ea018c9ff38ab4f4e9f3dae8 (diff)
downloadawesome-e5b5be048c087e04bd504d4c13a48317d7a45915.tar.gz
awesome-e5b5be048c087e04bd504d4c13a48317d7a45915.tar.bz2
Refactor for 4.x compatibility
Diffstat (limited to 'config.dot/awesome.link/signals.lua')
-rw-r--r--config.dot/awesome.link/signals.lua110
1 files changed, 89 insertions, 21 deletions
diff --git a/config.dot/awesome.link/signals.lua b/config.dot/awesome.link/signals.lua
index c65409f..d6a9f8a 100644
--- a/config.dot/awesome.link/signals.lua
+++ b/config.dot/awesome.link/signals.lua
@@ -1,30 +1,98 @@
-- {{{ 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 })
+--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
+-- Signal function to execute when a new client appears.
+client.connect_signal("manage", function (c)
+ -- Set the windows at the slave,
+ -- i.e. put it at the end of others instead of setting it master.
+ -- if not awesome.startup then awful.client.setslave(c) end
- -- 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 awesome.startup and
+ not c.size_hints.user_position
+ and not c.size_hints.program_position then
+ -- Prevent clients from being unreachable after screen count changes.
+ awful.placement.no_offscreen(c)
+ end
+end)
+
+-- Add a titlebar if titlebars_enabled is set to true in the rules.
+client.connect_signal("request::titlebars", function(c)
+ -- 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)
+ )
- 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)
+ awful.titlebar(c) : setup {
+ { -- Left
+ awful.titlebar.widget.iconwidget(c),
+ buttons = buttons,
+ layout = wibox.layout.fixed.horizontal
+ },
+ { -- Middle
+ { -- Title
+ align = "center",
+ widget = awful.titlebar.widget.titlewidget(c)
+ },
+ buttons = buttons,
+ layout = wibox.layout.flex.horizontal
+ },
+ { -- Right
+ awful.titlebar.widget.floatingbutton (c),
+ awful.titlebar.widget.maximizedbutton(c),
+ awful.titlebar.widget.stickybutton (c),
+ awful.titlebar.widget.ontopbutton (c),
+ awful.titlebar.widget.closebutton (c),
+ layout = wibox.layout.fixed.horizontal()
+ },
+ layout = wibox.layout.align.horizontal
+ }
+end)
- -- 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
+-- Enable sloppy focus, so that focus follows mouse.
+client.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)
-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)
+client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
+client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}