Hi,

I've just rewritten an old move.lua script to work with ion3.
Can anyone comment on it? I'm far from being a lua guru and surely had
missed something.

TIA,
Alex

---cut---
function ionws_move_current(frame, dir)
    local ws = frame
    while ws and not obj_is(ws, "WIonWS") do
        ws = ws:manager()
    end
    if not ws then return end
    local c = frame:current()
    local other = ws:goto_dir(dir)
    if c and obj_is(other, "WMPlex") then
        other:attach(c, { switchto = true })
    end
    if other then
        other:goto()
    end
end

defbindings("WFrame",{
    kpress(MOD1.."Control+H",
           "ionws_move_current(_, \"left\")"),
    kpress(MOD1.."Control+J",
           "ionws_move_current(_, \"down\")"),
    kpress(MOD1.."Control+K",
           "ionws_move_current(_, \"up\")"),
    kpress(MOD1.."Control+L",
           "ionws_move_current(_, \"right\")"),
})
---cut---

Reply via email to