[lua] Add awesome.font_set() to set the default font

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-21 17:03:10 +02:00
parent b3f8464800
commit 9754e1c039
1 changed files with 11 additions and 0 deletions

11
lua.c
View File

@ -272,6 +272,16 @@ luaA_openlib(lua_State *L, const char *name,
luaL_register(L, name, methods); luaL_register(L, name, methods);
} }
static void
luaA_font_set(lua_State *L)
{
const char *font = luaL_checkstring(L, 1);
draw_font_delete(&globalconf.font);
globalconf.font = draw_font_new(globalconf.connection,
globalconf.default_screen, font);
return 0;
}
bool bool
luaA_parserc(const char *rcfile) luaA_parserc(const char *rcfile)
{ {
@ -291,6 +301,7 @@ luaA_parserc(const char *rcfile)
{ "key", luaA_key }, { "key", luaA_key },
{ "mouse", luaA_mouse }, { "mouse", luaA_mouse },
{ "resizehints_set", luaA_resizehints_set }, { "resizehints_set", luaA_resizehints_set },
{ "font_set", luaA_font_set },
{ NULL, NULL } { NULL, NULL }
}; };
static const struct luaL_reg awesome_hooks_lib[] = static const struct luaL_reg awesome_hooks_lib[] =