File: collapse.lua

package info (click to toggle)
ion3-scripts 20050418-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 300 kB
  • ctags: 153
  • sloc: makefile: 18
file content (27 lines) | stat: -rw-r--r-- 552 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- 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