Hi,

I'm currently messing about with some lua code for ion-3ds that attempts
to implement a `show tabs only when necessary' feature (i.e., don't show a
tab for a frame that's empty or has only one window, but do show a tab for
frames containing two or more windows; I know this is a peculiar thing 
to want to do :-) ).

It's basically half working, in that using

function show_only_necessary_tabs_in_frame(f)
        if obj_is(f, "WFrame") then
            local t_hid=f:is_tabbar_hidden()
            local lt_two=f:lt_two_clients()
            if (t_hid and (not lt_two)) or ((not t_hid) and lt_two) then
                f:toggle_tab()
            end
        end
end

function dst_setup_hook()
    local hkname="frame_content_switched_hook"
    local hk=ioncore.get_hook(hkname)
    hk:add(show_only_necessary_tabs_in_frame)
end

the tab mode gets flipped appropriately when the number of
windows in a frame crosses the 2 window threshold __providing this change
causes a shift in the displayed region on the frame__. The problem is this
doesn't always happen, eg, if either the user or the application closes a
window which isn't currently active the display doesn't change and hence
the hook doesn't get called.

(FWIW, the code is experimental: lt_two_clients is a temporary hacked up
function whilst I figure out the right way to get the count of regions
managed by a frame in ion-3ds. Also, it seems to go wrong sometimes with
nested WIonWS's.)

I'm wondering about the possibility of having a hook added at some
convenient point during the evolution of Ion3. What'd be helpful would be
a hook which is called whenever the number of regions managed by an ion
frame changes (either increases due to a new window opening or decreases
due to a window closing). The handler parameters should definitely be
the frame and possibly the number of regions now managed by the frame.

Being honest, I can't think of any other use for this hook than what I
want to do with the tabs, but maybe others on the list can comment on
other things it might be used for, or suggest some better way to do this
without adding a new hook.

Many thanks,

__cheers, dave__________________________________________
www.inf.ed.ac.uk/people/staff/David_Tweed.html
tel: +44 131 651 3447  fax: +44 131 651 3435
"No, you're right. That was a stupid thing to do."


Reply via email to