From 442eb739c7198be723f5e9494707e596cd814c26 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 28 Aug 2008 11:29:21 +0200 Subject: [PATCH] client: add support for WM_WINDOW_ROLE access Signed-off-by: Julien Danjou --- awesomerc.lua.in | 11 ++++++++++- client.c | 8 ++++++++ common/atoms.list | 1 + common/tokenize.gperf | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 132933e6..30b30774 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -248,7 +248,16 @@ keybinding({ modkey, "Ctrl" }, "i", function () if mypromptbox.text then mypromptbox.text = nil else - mypromptbox.text = "Class: " .. client.focus.class .. " Instance: ".. client.focus.instance + mypromptbox.text = nil + if client.focus.class then + mypromptbox.text = "Class: " .. client.focus.class .. " " + end + if client.focus.instance then + mypromptbox.text = mypromptbox.text .. "Instance: ".. client.focus.instance .. " " + end + if client.focus.role then + mypromptbox.text = mypromptbox.text .. "Role: ".. client.focus.role + end end end):add() diff --git a/client.c b/client.c index eedd1a6d..6bd1f251 100644 --- a/client.c +++ b/client.c @@ -1257,6 +1257,7 @@ luaA_client_newindex(lua_State *L) * \lfield class The client class. * \lfield instance The client instance. * \lfield pid The client PID, if available. + * \lfield role The window role, if available. * \lfield machine The machine client is running on. * \lfield icon_name The client name when iconified. * \lfield floating_placement The floating placement used for this client. @@ -1307,6 +1308,13 @@ luaA_client_index(lua_State *L) return 0; lua_pushstring(L, hint.res_name); break; + case A_TK_ROLE: + if(!xutil_text_prop_get(globalconf.connection, (*c)->win, + WM_WINDOW_ROLE, &value, &slen)) + return 0; + lua_pushlstring(L, value, slen); + p_delete(&value); + break; case A_TK_PID: prop_c = xcb_get_property_unchecked(globalconf.connection, false, (*c)->win, _NET_WM_PID, CARDINAL, 0L, 1L); prop_r = xcb_get_property_reply(globalconf.connection, prop_c, NULL); diff --git a/common/atoms.list b/common/atoms.list index d4d85086..cc3dc749 100644 --- a/common/atoms.list +++ b/common/atoms.list @@ -44,3 +44,4 @@ WM_STATE _NET_WM_WINDOW_OPACITY _NET_SYSTEM_TRAY_ORIENTATION WM_CHANGE_STATE +WM_WINDOW_ROLE diff --git a/common/tokenize.gperf b/common/tokenize.gperf index fd332f2e..fe5e28d2 100644 --- a/common/tokenize.gperf +++ b/common/tokenize.gperf @@ -45,6 +45,7 @@ plot_properties_set position resize right +role screen selected shadow