> You should listen to frame_managed_changed_hook. No need to make > new bindings, just check when a frame becomes empty in that hook. > min_tabs.lua from the scripts repository might provide some useful > bits.
Thanks - I did just this, but face yet another issue, this time with the below code: local function close_empty_frame(ftable) if ftable.mode ~= 'remove' then return end local wmp = ftable.reg -- Should probably test that wmp is not nil here - or is it guaranteed to contain sth meaningful ? if WMPlex.mx_count(wmp) == 0 then ioncore.defer(WRegion.rqclose(wmp)) end end local hk=ioncore.get_hook("frame_managed_changed_hook") hk:add(close_empty_frame) Now the code does not hang anymore, but I get "ion3: Attempt to call an unsafe function "rqclose" in restricted mode." each time I close the last client in a frame. I thought ioncore.defer would do the trick and defer the execution of the rqclose until I am back in the main loop (so probably out of "restricted" mode), but it looks like it does not... What am I still missing ? Seb