Re: Move frames to and from scratchpad
Daniel Clemente <dcl441-bugs-/[email protected]>
| Newsgroups | gmane.comp.window-managers.ion.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I start with the easy one.
>> - 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.
I tried:
WMPlex.attach(ioncore.lookup_region("*scratchpad*"),_sub)
And it works very well. When I assigned it a key binding, at first it didn't work, but it was because I was using a WScreen binding instead of a WClientWin binding. I corrected that and this is the working code:
defbindings("WClientWin", {
kpress(META.."k", "WMPlex.attach(ioncore.lookup_region('*scratchpad*'),_)"),
})
> 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).
I'll leave the „multiple scratchpads“ part since I always have one and it seems harder to do.
I noticed that what you propose is similar to this code: http://modeemi.fi/~tuomov/repos/ion-scripts-3/scripts/cwin_sp.lua
>> If the scratchpad is open, then move the current frame (inside the scratchpad) to the window below the scratchpad. Don't close the scratchpad
> 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.
Yes, I meant that. Not geometrically (since below the scratchpad there may be more than 1 target) but just the last active window (in before the scratchpad was open.
This seems to work to move from scratchpad to a particular frame:
WMPlex.attach(ioncore.lookup_region('WFrame<1>'),_sub)
However, I don't know how to get the current „background“ group while I'm on the scratchpad. I tried your proposal, WScreen.mx_current(_), but for me WScreen.mx_current(_).name(_) while I'm in scratchpad returns just „*scratchpad*“ and not the name of the frame below. I'm probably not understanding the theory.
Could you please provide some example code for this one?
Thanks,
Daniel