File: zoom.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 (54 lines) | stat: -rw-r--r-- 2,477 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
-- zoom.lua
--
-- exchanges current client window with the active client window of the frame
-- called 'zoomframe' -- resembling the behavior of larswm
--
-- +---------------------------------------------------+-----------------+
-- |                                                   |                 |
-- |                                                   |                 |
-- |                                                   |                 |
-- |                                                   |   Client 1      |
-- |                                                   |                 |
-- |                                                   |                 |
-- |            Z o o m f r a m e  w i t h             +-----------------+
-- |            z o o m e d   C l i e nt               |                 |
-- |                                                   |                 |
-- |                                                   |   Client 2      |
-- |                                                   |                 |
-- |                                                   |                 |
-- |                                                   |                 |
-- +--------------------------------+------------------+-----------------+
-- |                                |                                    |
-- |                                |                                    |
-- |        Client 4                |            Client 3                |
-- |                                |                                    |
-- |                                |                                    |
-- +--------------------------------+------------------------------------+
--
-- Example: zoom_client on "Client 2" will put "Client 2" into the zoom frame
-- and "zoomed Client" into the frame of "Client 2"
--
-- By Rene van Bevern <rvb@pro-linux.de>, 2005
--	Public Domain
--
-- Example keybinding:
--
-- defbindings("WFrame", {
--    kpress(MOD1.."z", "zoom_client(_, _sub")
-- }

local zoomframe_name = 'zoomframe'

function zoom_client(curframe, curclient)
   local zoomframe = ioncore.lookup_region(zoomframe_name, 'WFrame')
   if (not zoomframe) or (curframe == zoomframe) then
      return
   end
   local zoomclient = zoomframe:lcurrent(1)
   zoomframe:attach(curclient)
   if zoomclient then
      curframe:attach(zoomclient)
   end
   zoomclient:goto() -- make it activated in the frame
   curclient:goto()
end