From f8c9b93be9229a38ca78c0e95b1260848c7ad859 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 13 Nov 2008 15:18:56 +0100 Subject: [PATCH] luaa: use fg/bg as keys for colors Signed-off-by: Julien Danjou --- lib/beautiful.lua.in | 4 ++-- luaa.c | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/beautiful.lua.in b/lib/beautiful.lua.in index 7c962601..d1f8ff3d 100644 --- a/lib/beautiful.lua.in +++ b/lib/beautiful.lua.in @@ -75,9 +75,9 @@ function init(path) elseif key == "font" then capi.awesome.font = value elseif key == "fg_normal" then - capi.awesome.colors({ fg = value }) + capi.awesome.fg = value elseif key == "bg_normal" then - capi.awesome.colors({ bg = value }) + capi.awesome.bg = value end -- Store. theme[key] = value diff --git a/luaa.c b/luaa.c index 95863300..eac73ee8 100644 --- a/luaa.c +++ b/luaa.c @@ -166,7 +166,7 @@ luaA_font_set(lua_State *L) return 0; } -/** Set default colors. +/** Set default colors (DEPRECATED). * \param L The Lua VM state. * \return The number of elements pushed on stack. * \luastack @@ -176,6 +176,7 @@ luaA_font_set(lua_State *L) static int luaA_colors(lua_State *L) { + deprecate(L); if(lua_gettop(L) == 1) { const char *buf; @@ -214,7 +215,6 @@ luaA_colors(lua_State *L) static int luaA_colors_set(lua_State *L) { - deprecate(L); return luaA_colors(L); } @@ -760,6 +760,12 @@ luaA_awesome_index(lua_State *L) case A_TK_CONFFILE: lua_pushstring(L, globalconf.conffile); break; + case A_TK_FG: + luaA_pushcolor(L, &globalconf.colors.fg); + break; + case A_TK_BG: + luaA_pushcolor(L, &globalconf.colors.bg); + break; default: return 0; } @@ -789,6 +795,14 @@ luaA_awesome_newindex(lua_State *L) globalconf.font = draw_font_new(newfont); } break; + case A_TK_FG: + if((buf = luaL_checklstring(L, 3, &len))) + xcolor_init_reply(xcolor_init_unchecked(&globalconf.colors.fg, buf, len)); + break; + case A_TK_BG: + if((buf = luaL_checklstring(L, 3, &len))) + xcolor_init_reply(xcolor_init_unchecked(&globalconf.colors.bg, buf, len)); + break; default: return 0; } -- 2.11.4.GIT