My first piece of lua for ion3: collapse.lua, ported to ion3. Any
remarks appreciated, I still have much to learn about lua and ion3 ...

Tuomov, can you add it to the ion3 scripts repository ?



-- Move all windows on a WIonWS to a single frame and destroy the rest.
-- (like C-x 1 in Emacs)
-- This is the ion3 version.

collapse={}


function collapse.move_managed(tgt, src)
   local l=WMPlex.llist(src,1)
   for _, m in l do
      tgt:attach(m)
   end
end

function collapse.collapse(ws)
   local l=ws:managed_list()
   local tgt=ws:current()
   for _, f in l do
      if obj_is(f, "WMPlex") then
         if tgt ~= f then
            collapse.move_managed(tgt, f)
            f:rqclose()
         end
      end
   end
   WRegion.goto(tgt)
end

-- 
Matthieu

Reply via email to