On Wed, Nov 16, 2005 at 05:41:58PM +0000, Tuomo Valkonen wrote:
> Obtain ioncore.clientwin_list
>
> Filter with ioncore.find_manager(-, "WGenWS")==workspace_of_current_window
>
> Find current_window on the filtered list, and take the next one
>
> How workspace_of_current_window and current_window are obtained depend
> on the parametrisation of the cycling function (and in which region
> type's bindmap it is bound).
Okay, I've hacked something together, but it's pretty hideous and I'd
appreciate suggestions for improvement.
David Roundy
-- windowcycle.lua
--
-- Example usage:
--
-- dopath("windowcycle")
--
-- defbindings("WFrame-on-WIonWS", {
-- kpress(MOD1.."Tab", "windowcycle.cycle(_)");
-- })
local windowcycle={}
_G["windowcycle"]=windowcycle
function windowcycle.cycle(frame)
local allwins = ioncore.clientwin_list()
local ws=ioncore.find_manager(frame, "WGenWS")
if not obj_is(ws, "WIonWS") then
warn("Expecting WIonWS")
return
end
local current_window = WMPlex.lcurrent(frame, 1)
foundit = 0
for _, w in allwins do
if ioncore.find_manager(w, "WGenWS") == ws then
if foundit == 1 then
w:goto()
return
end
if w == current_window then
foundit = 1
end
end
end
-- Okay, the current window must be last in the list
for _, w in allwins do
if ioncore.find_manager(w, "WGenWS") == ws then
w:goto()
return
end
end
end