local mouse_utils = {}

function mouse_utils.move_mouse_onto_focused_client()
    local c = client.focus
    if c then
        local geometry = c:geometry()
        local mouse_coords = mouse.coords()
        local margin = 10
        -- Don't move the mouse if it's already over the client
        if not (mouse_coords.x > geometry.x - margin
            and mouse_coords.x < geometry.x + geometry.width + margin
            and mouse_coords.y > geometry.y - margin
            and mouse_coords.y < geometry.y + geometry.height + margin) then

            local x = geometry.x + geometry.width/2
            local y = geometry.y + geometry.height/2
            mouse.coords({x = x, y = y}, true)
        end
    end
end

return mouse_utils