client: Add x, y, width and height properties

This commit is contained in:
Emmanuel Lepage Vallee 2016-05-10 00:01:12 -04:00
parent f4b2043da5
commit 43ef623dc6
2 changed files with 48 additions and 9 deletions

View File

@ -693,6 +693,54 @@ function client.floating.delete(c)
client.object.set_floating(c, nil) client.object.set_floating(c, nil)
end end
--- The x coordinates.
--
-- **Signal:**
--
-- * *property::x*
--
-- @property x
-- @param integer
--- The y coordinates.
--
-- **Signal:**
--
-- * *property::y*
--
-- @property y
-- @param integer
--- The width of the wibox.
--
-- **Signal:**
--
-- * *property::width*
--
-- @property width
-- @param width
--- The height of the wibox.
--
-- **Signal:**
--
-- * *property::height*
--
-- @property height
-- @param height
-- Add the geometry helpers to match the wibox API
for _, v in ipairs {"x", "y", "width", "height"} do
client.object["get_"..v] = function(c)
return c:geometry()[v]
end
client.object["set_"..v] = function(c, value)
return c:geometry({[v] = value})
end
end
--- Restore (=unminimize) a random client. --- Restore (=unminimize) a random client.
-- @function awful.client.restore -- @function awful.client.restore
-- @param s The screen to use. -- @param s The screen to use.

View File

@ -3423,21 +3423,12 @@ client_class_setup(lua_State *L)
signal_add(&client_class.signals, "property::transient_for"); signal_add(&client_class.signals, "property::transient_for");
signal_add(&client_class.signals, "property::type"); signal_add(&client_class.signals, "property::type");
signal_add(&client_class.signals, "property::urgent"); signal_add(&client_class.signals, "property::urgent");
/**
* @signal property::width
*/
signal_add(&client_class.signals, "property::width"); signal_add(&client_class.signals, "property::width");
/** /**
* @signal property::window * @signal property::window
*/ */
signal_add(&client_class.signals, "property::window"); signal_add(&client_class.signals, "property::window");
/**
* @signal property::x
*/
signal_add(&client_class.signals, "property::x"); signal_add(&client_class.signals, "property::x");
/**
* @signal property::y
*/
signal_add(&client_class.signals, "property::y"); signal_add(&client_class.signals, "property::y");
/** When a client should get activated (focused and/or raised). /** When a client should get activated (focused and/or raised).
* *