Sadly the t.preferred_screen_name is nil all the time when i use it like that. But i will just move them to any new screen that is connected for now.

Before i only used t:delete(new_tag, true) to move all the clients to the tag on the new screen, but that made the clients still render on the old screen while being assigned to the tag on the new screen. Is that a bug?

tag.connect_signal("request::screen", function(t)
clients = t:clients()
for s in screen do
if s ~= t.screen and clients and next(clients) then
t.screen = s
t.original_tag_name = t.original_tag_name or t.name
t.name = t.name .. "'"
t.volatile = true
return
end
end
end)
screen.connect_signal("added", function(s)
for k,t in pairs(root.tags()) do
if t.original_tag_name then
-- find the new tag on the new screen
new_tag = awful.tag.find_by_name(s, t.original_tag_name)
if new_tag then
t.name = t.original_tag_name
t.original_tag_name = nil
new_tag:swap(t)
new_tag:delete(t, true)
end
end
end
end)

Sadly the t.preferred_screen_name is nil all the time when i use it like that. But i will just move them to any new screen that is connected for now.

I just invented that property, you will need to set it somewhere. The request::screen is probably a little too late (I didn't tried) as (I think?) the screen is already invalid. Maybe something in property::screen is your best bet