On Fri, Aug 14, 2009 at 08:00:40AM +0000, Tuomo Valkonen wrote:
> One possibility is using WTiling.managed_i to go through
> the list of objects managed by the tiling. RTFM on details,
> but, e.g., the following snippet in Mod1+F3 prints the names
> of everything (except the somewhat transient stdisp) managed
> by the tiling:
> 
> _:manager():managed_i(function(x)
>                           print(x:name())
>                           return true
>                       end)
> 

I ended up using that to count the number of frames in the tiling. The
resulting code follows. Thanks for your help

local nframes
local function close_frame(p)
   m = p.reg:manager()
   if not m then return end
   local nframes = 0
   m:managed_i(function(x) nframes = nframes + 1 return true end)
   if nframes > 1 and p.reg:mx_count() == 0 then
      ioncore.defer(function() p.reg:rqclose()  end)
   end
end
ioncore.get_hook("frame_managed_changed_hook"):add(close_frame)


--
Javier

Reply via email to