From adedb9e39790d9b2f16cc8eb97021213c2629464 Mon Sep 17 00:00:00 2001 From: Alex Cornejo Date: Wed, 4 Jun 2008 22:48:05 -0400 Subject: [PATCH] Added get_class to client. This is useful for writing rules in the awesomerc.lua, since in the lua-less version it was possible to trigger rules based on the class of the window (as opposed to the name). Signed-off-by: Julien Danjou --- client.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/client.c b/client.c index e564734e..c4b5b822 100644 --- a/client.c +++ b/client.c @@ -1133,6 +1133,21 @@ luaA_client_tostring(lua_State *L) return 1; } +/** Get the client name. + * \return A string with the client class. + */ +static int +luaA_client_class_get(lua_State *L) +{ + client_t **c = luaA_checkudata(L, 1, "client"); + class_hint_t *hint=xutil_get_class_hint(globalconf.connection, (*c)->win); + if (hint) + lua_pushstring(L, hint->res_class); + else + luaL_error(L, "Unable to get the class property for client"); + return 1; +} + static int luaA_client_icon_set(lua_State *L) { @@ -1260,6 +1275,7 @@ const struct luaL_reg awesome_client_meta[] = { "floating_set", luaA_client_floating_set }, { "floating_get", luaA_client_floating_get }, { "icon_set", luaA_client_icon_set }, + { "class_get", luaA_client_class_get }, { "mouse_resize", luaA_client_mouse_resize }, { "mouse_move", luaA_client_mouse_move }, { "unmanage", luaA_client_unmanage },