One interesting use case for this is to only do expensive
operations if something is connected to the signal:
-- item:connect_signal("connection",function(_,name,count)
-- if name == "mouse::move" and count == 0 then
-- widget:connect_signal("mouse::move",conn)
-- end
-- end)
-- item:connect_signal("disconnection",function(_,name,count)
-- if count == 0 then
-- widget:connect_signal("mouse::move",conn)
-- end
-- end)
This is Radical, a new menu implementation for AwesomeWM. It make it easy to abstract look and behavior or various types of menu with object oriented abstractions. While slower, this make it easier to maintain and extend.