File: move_current.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 (25 lines) | stat: -rw-r--r-- 694 bytes parent folder | download | duplicates (4)
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
-- Move current window in a frame to another frame in specified direction

function move_current(frame, dir)
    local curr=frame:current()
    local mgr=frame:manager()
    
    if not curr or not obj_is(mgr, "WIonWS") then 
        return 
    end
    
    local frame2=mgr:next_to(frame, dir)
    
    if frame2 then
        frame2:attach(curr, { switchto=true })
    end
end

ionframe_bindings{
    submap("Mod1+K", {
        kpress("Up", function(f) move_current(f, "above") end),
        kpress("Down", function(f) move_current(f, "below") end),
        kpress("Left", function(f) move_current(f, "left") end),
        kpress("Right", function(f) move_current(f, "right") end),
    }),
}