Tuomo Valkonen wrote:
Just ask what you need or maybe send me the patches (but I might not
approve if I can think of a better alternative).

Using the earlier sent hooks I'm able to write the following lua script to deal with clashing key-maps. Notice that I also use the allready provided hook for frame-switching. This is crude, but it explains what I'm after (more comments after src):


-- -- BEGIN SCRIPT
--
-- A crude example for dealing with clashing keymaps using ion
-- callback hooks
--
-- Niclas Olofsson 2003-09-28
-- [EMAIL PROTECTED]
--
-- This is based on an extension to ions hook support, where ion
-- provides hooks on genframe_activated (focus event)
--
-- --

local function noop(src) end

local function checkIdea(frm, reg)
    if string.find(WRegion.name(reg), "idea") ~= nil then
        genframe_bindings{
            kpress("Control+Shift+Tab", noop),
            kpress("Control+Tab", noop),
        }
    else
        genframe_bindings{
            kpress("Control+Tab", WGenFrame.switch_next),
            kpress("Control+Shift+Tab", WGenFrame.switch_prev),
        }
    end
end

add_to_hook("genframe_managed_switched", checkIdea)
add_to_hook("genframe_activated", checkIdea)

-- -- END SCRIPT

There is no noticable performance decrease using this. Missing is a feature to query existing key-map-actions to be able to store them for later re-mapping. The script should also query for xwindow-props and use that instead of the tile of the frame in question. There are lua functions for that part allready in ion, aren't there?

The best would perhaps be if it was possible to define key-maps stored in a variable and shift between them at will.

ioncore_bindings("my_map_name", {
     kpress("Control+Tab", WGenFrame.switch_next),
     kpress("Control+Shift+Tab", WGenFrame.switch_prev),
})
...
a_map = ioncore_bindings("my_map_name")
genframe_set_bindings(a_map) -- replaces the current map completely

Perhaps something like genframe_clear_bindings() would be enough (instead of the above). I mean, you can always store handle the "map" yourself in lua, that is, if there would exist some way to clear it at will.

Cheers,
/Niclas




Reply via email to