[awful] client_moveresize(+/- x-offset, +/- y-offset, +/- width, +/- height)

e.g.:
awful.client.moveresize(10, 0, 0, 0) --increase x-offset by 10 pixels -> moves it to the right
awful.client.moveresize(0, 0, -10, 0) --decreases width of client by 10 pixels

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
marco candrian 2008-06-06 01:17:41 +02:00 committed by Julien Danjou
parent 2b4ffb4b74
commit 57227075d9
1 changed files with 17 additions and 5 deletions

View File

@ -73,6 +73,17 @@ function client_swap(i)
end end
end end
-- Move/resize a client relativ to current coordinates.
function client_moveresize(x, y, w, h)
local sel = client.focus_get()
local coords = sel:coords_get()
coords['x'] = coords['x'] + x
coords['y'] = coords['y'] + y
coords['width'] = coords['width'] + w
coords['height'] = coords['height'] + h
sel:coords_set(coords)
end
function screen_focus(i) function screen_focus(i)
local sel = client.focus_get() local sel = client.focus_get()
local s local s
@ -263,7 +274,7 @@ function layout_set(layout)
end end
end end
-- Hook functions, wrappers around awesome's hooks. functions so we -- Hook functions, wrappers around awesome's hooks. functions so we
-- can easily add multiple functions per hook. -- can easily add multiple functions per hook.
P.hooks = {} P.hooks = {}
P.myhooks = {} P.myhooks = {}
@ -275,11 +286,11 @@ for name, hook in pairs(hooks) do
if P.myhooks[name] == nil then if P.myhooks[name] == nil then
P.myhooks[name] = {} P.myhooks[name] = {}
hooks[name](function (...) hooks[name](function (...)
for i,o in pairs(P.myhooks[name]) do for i,o in pairs(P.myhooks[name]) do
P.myhooks[name][i]['callback'](...) P.myhooks[name][i]['callback'](...)
end end
end) end)
end end
@ -291,7 +302,7 @@ for name, hook in pairs(hooks) do
if P.myhooks[name] == nil then if P.myhooks[name] == nil then
P.myhooks[name] = {} P.myhooks[name] = {}
hooks[name](1, function (...) hooks[name](1, function (...)
for i,o in pairs(P.myhooks[name]) do for i,o in pairs(P.myhooks[name]) do
if P.myhooks[name][i]['counter'] >= P.myhooks[name][i]['timer'] then if P.myhooks[name][i]['counter'] >= P.myhooks[name][i]['timer'] then
P.myhooks[name][i]['counter'] = 1 P.myhooks[name][i]['counter'] = 1
@ -300,7 +311,7 @@ for name, hook in pairs(hooks) do
P.myhooks[name][i]['counter'] = P.myhooks[name][i]['counter']+1 P.myhooks[name][i]['counter'] = P.myhooks[name][i]['counter']+1
end end
end end
end) end)
end end
@ -342,6 +353,7 @@ P.client =
movetotag = client_movetotag; movetotag = client_movetotag;
toggletag = client_toggletag; toggletag = client_toggletag;
togglefloating = client_togglefloating; togglefloating = client_togglefloating;
moveresize = client_moveresize;
} }
P.screen = P.screen =
{ {