Re: Scripting problem
Ole Jørgen Brønner <[email protected]> Wed, 03 Jun 2009 22:29:35 +0200
| Newsgroups | gmane.comp.window-managers.ion.general |
|---|---|
| Message-ID | <op.uuytvjusvocxtk@tabole-debian> |
ioncore.defer takes a _function_. In your code WRegion.rqclose(wmp) will be executed and the result will be passed to defer. You need to wrap the function call in a lamba like this: ioncore.defer(function () WRegion.rqclose(wmp) end) -- Ole Jørgen Brønner On Wed, 03 Jun 2009 22:20:00 +0200, Seb Haezebrouck <[email protected]> wrote: >> You should listen to frame_managed_changed_hook. No need to make >> new bindings, just check when a frame becomes empty in that hook. >> min_tabs.lua from the scripts repository might provide some useful >> bits. > > Thanks - I did just this, but face yet another issue, this time with the > below code: > > local function close_empty_frame(ftable) > if ftable.mode ~= 'remove' then return end > local wmp = ftable.reg > -- Should probably test that wmp is not nil here - or is it > guaranteed > to contain sth meaningful ? > if WMPlex.mx_count(wmp) == 0 then > ioncore.defer(WRegion.rqclose(wmp)) > end > end > > local hk=ioncore.get_hook("frame_managed_changed_hook") > hk:add(close_empty_frame) > > Now the code does not hang anymore, but I get "ion3: Attempt to call an > unsafe function "rqclose" in restricted mode." each time I close the last > client in a frame. > > I thought ioncore.defer would do the trick and defer the execution of the > rqclose until I am back in the main loop (so probably out of "restricted" > mode), but it looks like it does not... What am I still missing ? > > Seb > > >