[lua] Add colors_set() function

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-23 18:15:41 +02:00
parent 81a1531f7a
commit f76357499c
2 changed files with 20 additions and 0 deletions

View File

@ -3,6 +3,11 @@
-- Include awesome library, with lots of useful function!
require("awful")
-- {{{ Colors and fonts
awesome.font_set("sans 8")
awesome.colors_set({ fg = "white", bg = "black" })
-- }}}
-- {{{ Variables definitions
-- This is used later as the default terminal to run.
terminal = "xterm"

15
lua.c
View File

@ -291,6 +291,20 @@ luaA_font_set(lua_State *L)
return 0;
}
static int
luaA_colors_set(lua_State *L)
{
const char *fg, *bg;
luaA_checktable(L, 1);
if((fg = luaA_getopt_string(L, 1, "fg", NULL)))
draw_color_new(globalconf.connection, globalconf.default_screen,
fg, &globalconf.colors.fg);
if((bg = luaA_getopt_string(L, 1, "bg",NULL)))
draw_color_new(globalconf.connection, globalconf.default_screen,
bg, &globalconf.colors.bg);
return 0;
}
bool
luaA_parserc(const char *rcfile)
{
@ -311,6 +325,7 @@ luaA_parserc(const char *rcfile)
{ "mouse", luaA_mouse },
{ "resizehints_set", luaA_resizehints_set },
{ "font_set", luaA_font_set },
{ "colors_set", luaA_colors_set },
{ NULL, NULL }
};
static const struct luaL_reg awesome_hooks_lib[] =