Discussion:
scripting winprop extension
Maximilian W. Zeller
2009-08-08 13:05:17 UTC
Permalink
hi again

i am not quite familiar with lua but think it must be something like
the following to extend winprop by the option position. I don't know
how to make ion3 use this file. Is it enough to just put it in the
~/.ion3 folder? And as i said i don't know if this is how its done. I
got these functions from the documentation but i am not sure if i used
them right.

-- usage:
-- defwinprop {
-- class = "something"
-- instance = "anything"
-- float = true
-- position = { x = 100, y = 100 }
-- }

windowpos = {}

function windowpos.set (cwin, tab) {

local prop = ioncore.get_winprop(cwin)
if prop and prop.float and prop.position then

local horizmul = prop.position.x
local vertmul = prop.position.y

WFloatFrame.begin_resize(cwin)
WFloatFrame.do_move(cwin, horizmul, vertmul)
WFloatFrame.end_resize(cwin)

return true

end

return false
}

ioncore.get_hook("clientwin_do_manage_alt"):add(windowpos.set)
o***@public.gmane.org
2009-08-08 16:00:31 UTC
Permalink
Yes, something like that, but I'm not sure if you can define arbitrary
winprops. Also You can simpy do cwin:rqgeom({x=prop.position.x,
y=prop.position.y})

- Ole Jørgen Brønner

On Sat, 08 Aug 2009 15:05:17 +0200, Maximilian W. Zeller
Post by Maximilian W. Zeller
hi again
i am not quite familiar with lua but think it must be something like
the following to extend winprop by the option position. I don't know
how to make ion3 use this file. Is it enough to just put it in the
~/.ion3 folder? And as i said i don't know if this is how its done. I
got these functions from the documentation but i am not sure if i used
them right.
-- defwinprop {
-- class = "something"
-- instance = "anything"
-- float = true
-- position = { x = 100, y = 100 }
-- }
windowpos = {}
function windowpos.set (cwin, tab) {
local prop = ioncore.get_winprop(cwin)
if prop and prop.float and prop.position then
local horizmul = prop.position.x
local vertmul = prop.position.y
WFloatFrame.begin_resize(cwin)
WFloatFrame.do_move(cwin, horizmul, vertmul)
WFloatFrame.end_resize(cwin)
return true
end
return false
}
ioncore.get_hook("clientwin_do_manage_alt"):add(windowpos.set)
Tuomo Valkonen
2009-08-09 21:43:06 UTC
Permalink
Post by Maximilian W. Zeller
hi again
i am not quite familiar with lua but think it must be something like
the following to extend winprop by the option position. I don't know
how to make ion3 use this file. Is it enough to just put it in the
~/.ion3 folder? And as i said i don't know if this is how its done. I
got these functions from the documentation but i am not sure if i used
them right.
It won't work that easily. clientwin_do_manage_alt is a very
low-level hook, and it should go through all the trouble of
finding the workspaces to place the window on, and do all the
attaching of the window there, etc.

Also, as already mentioned, rqgeom is the correct function
for requesting a change in geometry, instead of the ones
that are meant to control an interactive session. *However*
in this case the requested geometry should be simply passed
to the appropriate 'attach' routine, as the window has not
yet been attached anywhere in this hook.
--
Stop Gnomes and other pests! Purchase Windows today!
http://iki.fi/tuomov/b/archives/2009/07/21/T17_26_09/
Loading...