From a6fb932bbc779d921ccda5a8a146b00e3dfb9a6f Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 23 Mar 2014 18:15:03 +0100 Subject: [PATCH] awesome: Add get_* and set_xproperty Signed-off-by: Uli Schlachter --- luaa.c | 2 ++ luadoc/awesome.lua | 11 +++++++++++ property.c | 20 ++++++++++++++++++++ property.h | 2 ++ 4 files changed, 35 insertions(+) diff --git a/luaa.c b/luaa.c index f42df0ce..01b08d2f 100644 --- a/luaa.c +++ b/luaa.c @@ -358,6 +358,8 @@ luaA_init(xdgHandle* xdg) { "systray", luaA_systray }, { "load_image", luaA_load_image }, { "register_xproperty", luaA_register_xproperty }, + { "set_xproperty", luaA_set_xproperty }, + { "get_xproperty", luaA_get_xproperty }, { "__index", luaA_awesome_index }, { NULL, NULL } }; diff --git a/luadoc/awesome.lua b/luadoc/awesome.lua index f7d879c1..ec6c61d6 100644 --- a/luadoc/awesome.lua +++ b/luadoc/awesome.lua @@ -44,6 +44,17 @@ module("awesome") -- @name register_xproperty -- @class function +--- Change a xproperty. +-- @param name The name of the X11 property +-- @param value The new value for the property +-- @name set_xproperty +-- @class function + +--- Get the value of a xproperty. +-- @param name The name of the X11 property +-- @name get_xproperty +-- @class function + --- Add a global signal. -- @param name A string with the event name. -- @param func The function to call. diff --git a/property.c b/property.c index 59a97988..0f5bbb0d 100644 --- a/property.c +++ b/property.c @@ -525,4 +525,24 @@ luaA_register_xproperty(lua_State *L) return 0; } +/** Set an xproperty. + * \param L The Lua VM state. + * \return The number of elements pushed on stack. + */ +int +luaA_set_xproperty(lua_State *L) +{ + return window_set_xproperty(L, globalconf.screen->root, 1, 2); +} + +/** Get an xproperty. + * \param L The Lua VM state. + * \return The number of elements pushed on stack. + */ +int +luaA_get_xproperty(lua_State *L) +{ + return window_get_xproperty(L, globalconf.screen->root, 1); +} + // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/property.h b/property.h index 59277f87..ded1b75a 100644 --- a/property.h +++ b/property.h @@ -47,6 +47,8 @@ PROPERTY(net_wm_icon); void property_handle_propertynotify(xcb_property_notify_event_t *ev); int luaA_register_xproperty(lua_State *L); +int luaA_set_xproperty(lua_State *L); +int luaA_get_xproperty(lua_State *L); struct xproperty { xcb_atom_t atom;