-- -- Author: Ole Jørgen Brønner (olejorgenb at yahoo dot no) -- split_util={} -- neigbour left/right/above/below frame -- use ioncore.navi_next(reg,dir,param) instead function split_util.neighbour(frame, dir) return frame:manager():nextto(frame, dir) end function split_util.move(frame, dir, param) local curr=frame:current() local mgr=frame:manager() param = { switchto=true } --if not curr or not (obj_is(mgr, "WIonWS")) -- return --end local frame2=mgr:nextto(frame, dir) if frame2 then frame2:attach(curr) if param.switchto then curr:goto() end end end -- leaves the visible window in frame_1 active (focused) function split_util.swap(frame_1, frame_2) local visible_2 = frame_2:current() local visible_1 = frame_1:current() local index_2 = frame_2:get_index(visible_2) local index_1 = frame_1:get_index(visible_1) frame_1:attach(visible_2, { index=index_1, switchto=false }) frame_2:attach(visible_1, { index=index_2, switchto=true }) visible_1:goto() end function split_util.swap_lr(frame) split_util.swap(frame, ioncore.navi_next(frame, "left")) end function split_util.move_nth(frame, n) local left_neigbour = ioncore.navi_next(frame, "left") --split_util.neighbour(frame, "left") left_neigbour:attach(frame:mx_nth(n), { switchto=true }) end function split_util.activate_nth(frame, n) local left_neigbour = ioncore.navi_next(frame:screen_of(), "left") left_neigbour:switch_nth(n) end defbindings("WFrame", { kpress(META.."Q", "split_util.swap_lr(_)"), kpress(META.."O", "split_util.move(_, 'left')"), kpress(META.."I", "split_util.move(_, 'right')"), submap(META.."J", { kpress("1", "split_util.move_nth(_, 0)"), kpress("2", "split_util.move_nth(_, 1)"), kpress("3", "split_util.move_nth(_, 2)"), kpress("4", "split_util.move_nth(_, 3)"), kpress("5", "split_util.move_nth(_, 4)"), kpress("6", "split_util.move_nth(_, 5)"), kpress("7", "split_util.move_nth(_, 6)"), kpress("8", "split_util.move_nth(_, 7)"), kpress("9", "split_util.move_nth(_, 8)"), kpress("0", "split_util.move_nth(_, 9)"), }), submap(META.."U", { kpress("1", "split_util.activate_nth(_, 0)"), kpress("2", "split_util.activate_nth(_, 1)"), kpress("3", "split_util.activate_nth(_, 2)"), kpress("4", "split_util.activate_nth(_, 3)"), kpress("5", "split_util.activate_nth(_, 4)"), kpress("6", "split_util.activate_nth(_, 5)"), kpress("7", "split_util.activate_nth(_, 6)"), kpress("8", "split_util.activate_nth(_, 7)"), kpress("9", "split_util.activate_nth(_, 8)"), kpress("0", "split_util.activate_nth(_, 9)"), }), })