local awful = require("awful")

-- 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

	-- Prevent clients from being unreachable after screen count changes.
	if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
		awful.placement.no_offscreen(c)
	end
end)

-- Floating clients should always be on top
client.connect_signal("property::floating", function(c)
	if not c.fullscreen then
		c.ontop = c.floating
	end
end)

-- Disable maximized clients
client.connect_signal("property::maximized", function(c)
	c.maximized = false
end)