awesomewm/clients/signals.lua

56 lines
1.3 KiB
Lua
Executable File

-- Signal function to execute when a new client appears.
-- Run in rc.lua
local titlebar = require("clients.titlebar")
local render = require("clients.render")
-- Add a titlebar
client.connect_signal("request::titlebars", titlebar.add)
-- Update titlebars when a screen is arranged
screen.connect_signal("arrange",
function(screen)
for _, client in pairs(screen.clients) do
titlebar.update(client)
render.renderClient(client)
end
end
)
client.connect_signal("manage",
function (client)
-- Update titlebar status
titlebar.update(client)
render.renderClient(client)
-- 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 (
client.size_hints.user_position or client.size_hints.program_position
) then
awful.placement.no_offscreen(client)
end
end
)
--[[ Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter",
function(c)
c:emit_signal(
"request::activate",
"mouse_enter",
{
raise = true
}
)
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)