I have implemented a [1]suggestion by Martin Michlmayr to make the keys
for resizing Ion frames more intuitive. With this modification, down grows
the window downwards, up shrinks the window upwards, right grows the
window rightwards, and left shrinks the window leftwards. The exception
are frames on the right and bottom edges where the meaning of the keys are
reversed (this is inconsistent but I felt it was more intuitive).

I have attached the code to be added to ionws.lua. Is it possible that
this modification will be included in the next release?

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=213903
--
-- Alternative resizing for ion-devel
--

function ionws_alt_resize(f, dir)
    local m = f:manager()

   if dir == "left" then
       if m:right_of(f) then
           f:do_resize( 0,-1, 0, 0)
       else
           f:do_resize( 1, 0, 0, 0)
       end
   elseif dir == "right" then
       if m:right_of(f) then
           f:do_resize( 0, 1, 0, 0)
       else
           f:do_resize(-1, 0, 0, 0)
       end
   elseif dir == "up" then
       if m:below(f) then
           f:do_resize( 0, 0, 0,-1)
       else
           f:do_resize( 0, 0, 1, 0)
       end
   elseif dir == "down" then
       if m:below(f) then
           f:do_resize( 0, 0, 0, 1)
       else
           f:do_resize( 0, 0,-1, 0)
       end
   end
end

ionframe_moveres_bindings{
    kpress("Left",  function(f) ionws_alt_resize(f, "left" ) end),
    kpress("Right", function(f) ionws_alt_resize(f, "right") end),
    kpress("Up",    function(f) ionws_alt_resize(f, "up"   ) end),
    kpress("Down",  function(f) ionws_alt_resize(f, "down" ) end),
    kpress("F",     function(f) ionws_alt_resize(f, "left" ) end),
    kpress("B",     function(f) ionws_alt_resize(f, "right") end),
    kpress("P",     function(f) ionws_alt_resize(f, "up"   ) end),
    kpress("N",     function(f) ionws_alt_resize(f, "down" ) end),
}

Reply via email to