awful.tag: Delete a screen's tag on removal
Any clients with these tags end up somewhere random (the first tag on the first remaining screen). This certainly can be improved in the future, but at least this is a start. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
851e0065fe
commit
975aac5c0c
|
@ -1352,11 +1352,35 @@ capi.tag.add_signal("property::urgent")
|
||||||
|
|
||||||
capi.tag.add_signal("property::urgent_count")
|
capi.tag.add_signal("property::urgent_count")
|
||||||
capi.tag.add_signal("property::volatile")
|
capi.tag.add_signal("property::volatile")
|
||||||
|
capi.tag.add_signal("removal-pending")
|
||||||
|
|
||||||
capi.screen.add_signal("tag::history::update")
|
capi.screen.add_signal("tag::history::update")
|
||||||
|
|
||||||
capi.screen.connect_signal("tag::history::update", tag.history.update)
|
capi.screen.connect_signal("tag::history::update", tag.history.update)
|
||||||
|
|
||||||
|
capi.screen.connect_signal("removed", function(s)
|
||||||
|
-- First give other code a chance to clean up
|
||||||
|
for _, t in pairs(s.tags) do
|
||||||
|
t:emit_signal("removal-pending")
|
||||||
|
end
|
||||||
|
-- Then force all clients left to go somewhere random
|
||||||
|
local fallback = nil
|
||||||
|
for other_screen in capi.screen do
|
||||||
|
if #other_screen.tags > 0 then
|
||||||
|
fallback = other_screen.tags[1]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _, t in pairs(s.tags) do
|
||||||
|
t:delete(fallback, true)
|
||||||
|
end
|
||||||
|
-- If any tag survived until now, forcefully get rid of it
|
||||||
|
for _, t in pairs(s.tags) do
|
||||||
|
t.activated = false
|
||||||
|
data.tags[t] = nil
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
function tag.mt:__call(...)
|
function tag.mt:__call(...)
|
||||||
return tag.new(...)
|
return tag.new(...)
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,6 +100,8 @@ end
|
||||||
screen._add_screen {width=320, height=240}
|
screen._add_screen {width=320, height=240}
|
||||||
|
|
||||||
screen.add_signal("property::workarea")
|
screen.add_signal("property::workarea")
|
||||||
|
screen.add_signal("added")
|
||||||
|
screen.add_signal("removed")
|
||||||
|
|
||||||
return screen
|
return screen
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue