[client] Add a hook on urgent flag
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
83470a99e8
commit
ebb56ce6b1
6
client.c
6
client.c
|
@ -666,11 +666,13 @@ client_updatewmhints(client_t *c)
|
|||
if((wmh = xcb_get_wm_hints(globalconf.connection, c->win)))
|
||||
{
|
||||
const uint32_t wm_hints_flags = xcb_wm_hints_get_flags(wmh);
|
||||
if((c->isurgent = ((wm_hints_flags & XCB_WM_X_URGENCY_HINT) &&
|
||||
globalconf.focus->client != c)))
|
||||
if((c->isurgent = (wm_hints_flags & XCB_WM_X_URGENCY_HINT)))
|
||||
{
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
titlebar_draw(c);
|
||||
/* execute hook */
|
||||
luaA_client_userdata_new(c);
|
||||
luaA_dofunction(globalconf.L, globalconf.hooks.urgent, 1);
|
||||
}
|
||||
if((wm_hints_flags & XCB_WM_STATE_HINT) &&
|
||||
(xcb_wm_hints_get_initial_state(wmh) == XCB_WM_WITHDRAWN_STATE))
|
||||
|
|
15
lua.c
15
lua.c
|
@ -360,6 +360,20 @@ luaA_hooks_titleupdate(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** Set the function called when a client get urgency flag. This function is called with
|
||||
* the client object as argument.
|
||||
* \param A function to call when a client get the urgent flag.
|
||||
*/
|
||||
static int
|
||||
luaA_hooks_urgent(lua_State *L)
|
||||
{
|
||||
luaA_checkfunction(L, 1);
|
||||
if(globalconf.hooks.urgent)
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, globalconf.hooks.urgent);
|
||||
globalconf.hooks.urgent = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Set default font.
|
||||
* \param A string with a font name in Pango format.
|
||||
*/
|
||||
|
@ -439,6 +453,7 @@ luaA_parserc(const char *rcfile)
|
|||
{ "mouseover", luaA_hooks_mouseover },
|
||||
{ "arrange", luaA_hooks_arrange },
|
||||
{ "titleupdate", luaA_hooks_titleupdate },
|
||||
{ "urgent", luaA_hooks_urgent },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue