From 43ef623dc65085021ed38289dfc92181e9d4053f Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Tue, 10 May 2016 00:01:12 -0400 Subject: [PATCH] client: Add x, y, width and height properties --- lib/awful/client.lua | 48 ++++++++++++++++++++++++++++++++++++++++++++ objects/client.c | 9 --------- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/lib/awful/client.lua b/lib/awful/client.lua index fdad1605..bbc008a7 100644 --- a/lib/awful/client.lua +++ b/lib/awful/client.lua @@ -693,6 +693,54 @@ function client.floating.delete(c) client.object.set_floating(c, nil) 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. -- @function awful.client.restore -- @param s The screen to use. diff --git a/objects/client.c b/objects/client.c index dababb9f..c696f06f 100644 --- a/objects/client.c +++ b/objects/client.c @@ -3423,21 +3423,12 @@ client_class_setup(lua_State *L) signal_add(&client_class.signals, "property::transient_for"); signal_add(&client_class.signals, "property::type"); signal_add(&client_class.signals, "property::urgent"); - /** - * @signal property::width - */ signal_add(&client_class.signals, "property::width"); /** * @signal property::window */ signal_add(&client_class.signals, "property::window"); - /** - * @signal property::x - */ signal_add(&client_class.signals, "property::x"); - /** - * @signal property::y - */ signal_add(&client_class.signals, "property::y"); /** When a client should get activated (focused and/or raised). *