On 2008-09-21 19:23 +0200, Daniel Clemente wrote:
> - If the scratchpad is open, then move the current frame (inside the
> scratchpad) to the window below the scratchpad. Don't close the scratchpad

This is a bit tricky, if "below" is to be taken geometrically. I'm not 
sure if it is 100% doable on the Lua side. The problem is that Ion does 
not expose the stacking orders to the Lua scripts. Otherwise, one would
just have to recursively scan from the root, checking the geometries of 
objects.. and it will work in a typical tiled arrangement, but not in 
a messy floating arrangement.

Perhaps easier would be to use the screen's mx_current object, which
is typically the current group, and then recurse WRegion.current until
it produces a frame and use that as the target (or the last frame seen
until the recursion returns no result). The result should typically be
the frame that was last active on the current workspace.

> - If the scratchpad is not open, then move the current frame to the
> scratchpad. Don't open the scratchpad

This should be rather easy. Just use ioncore.lookup_region to find one
named "*scratchpad*", and use WMPlex.attach on it. If there are multiple
scratchpads (such as when there are multiple screens), one may have to 
choose between them, numbered in the typical fashion (*scratchpad*, 
*scratchpad*<1>, ... etc., but with guaranteed correspondence to screen
numbers). In that case ioncore.region_i may be better. One can also cache them 
in variables the script to not have to look them up all the time. 
(obj_exists is then useful to check that the scratchpad is still there).
An alternative to the global scanning functions in ioncore. is to
use WScreen.mx_i, which is also what the modules does (essentially, 
but in C).


-- 
Tuomo

Reply via email to