[lua] Add an hook on arrange
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
c6261b028b
commit
9a0ed4d0d3
3
layout.c
3
layout.c
|
@ -89,6 +89,9 @@ arrange(int screen)
|
||||||
|
|
||||||
/* reset status */
|
/* reset status */
|
||||||
globalconf.screens[screen].need_arrange = false;
|
globalconf.screens[screen].need_arrange = false;
|
||||||
|
|
||||||
|
/* call hook */
|
||||||
|
luaA_dofunction(globalconf.L, globalconf.hooks.arrange, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Refresh the screen disposition
|
/** Refresh the screen disposition
|
||||||
|
|
11
lua.c
11
lua.c
|
@ -257,6 +257,16 @@ luaA_hooks_mouseover(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
luaA_hooks_arrange(lua_State *L)
|
||||||
|
{
|
||||||
|
luaA_checkfunction(L, 1);
|
||||||
|
if(globalconf.hooks.arrange)
|
||||||
|
luaL_unref(L, LUA_REGISTRYINDEX, globalconf.hooks.arrange);
|
||||||
|
globalconf.hooks.arrange = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
luaA_openlib(lua_State *L, const char *name,
|
luaA_openlib(lua_State *L, const char *name,
|
||||||
const struct luaL_reg methods[],
|
const struct luaL_reg methods[],
|
||||||
|
@ -309,6 +319,7 @@ luaA_parserc(const char *rcfile)
|
||||||
{ "unfocus", luaA_hooks_unfocus },
|
{ "unfocus", luaA_hooks_unfocus },
|
||||||
{ "newclient", luaA_hooks_newclient },
|
{ "newclient", luaA_hooks_newclient },
|
||||||
{ "mouseover", luaA_hooks_mouseover },
|
{ "mouseover", luaA_hooks_mouseover },
|
||||||
|
{ "arrange", luaA_hooks_arrange },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -412,6 +412,8 @@ struct AwesomeConf
|
||||||
luaA_function unfocus;
|
luaA_function unfocus;
|
||||||
/** Command to run when mouse is over */
|
/** Command to run when mouse is over */
|
||||||
luaA_function mouseover;
|
luaA_function mouseover;
|
||||||
|
/** Command to run on arrange */
|
||||||
|
luaA_function arrange;
|
||||||
} hooks;
|
} hooks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue