From f76357499c51f43b90a71992b108bd4be26116a6 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 23 May 2008 18:15:41 +0200 Subject: [PATCH] [lua] Add colors_set() function Signed-off-by: Julien Danjou --- awesomerc.lua.in | 5 +++++ lua.c | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/awesomerc.lua.in b/awesomerc.lua.in index cd95bdd68..6217ca05e 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -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" diff --git a/lua.c b/lua.c index db5514c69..95f30e6fa 100644 --- a/lua.c +++ b/lua.c @@ -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[] =