luaa: use fg/bg as keys for colors

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-11-13 15:18:56 +01:00
parent 292f09bb93
commit f8c9b93be9
2 changed files with 18 additions and 4 deletions

View File

@ -75,9 +75,9 @@ function init(path)
elseif key == "font" then elseif key == "font" then
capi.awesome.font = value capi.awesome.font = value
elseif key == "fg_normal" then elseif key == "fg_normal" then
capi.awesome.colors({ fg = value }) capi.awesome.fg = value
elseif key == "bg_normal" then elseif key == "bg_normal" then
capi.awesome.colors({ bg = value }) capi.awesome.bg = value
end end
-- Store. -- Store.
theme[key] = value theme[key] = value

18
luaa.c
View File

@ -166,7 +166,7 @@ luaA_font_set(lua_State *L)
return 0; return 0;
} }
/** Set default colors. /** Set default colors (DEPRECATED).
* \param L The Lua VM state. * \param L The Lua VM state.
* \return The number of elements pushed on stack. * \return The number of elements pushed on stack.
* \luastack * \luastack
@ -176,6 +176,7 @@ luaA_font_set(lua_State *L)
static int static int
luaA_colors(lua_State *L) luaA_colors(lua_State *L)
{ {
deprecate(L);
if(lua_gettop(L) == 1) if(lua_gettop(L) == 1)
{ {
const char *buf; const char *buf;
@ -214,7 +215,6 @@ luaA_colors(lua_State *L)
static int static int
luaA_colors_set(lua_State *L) luaA_colors_set(lua_State *L)
{ {
deprecate(L);
return luaA_colors(L); return luaA_colors(L);
} }
@ -760,6 +760,12 @@ luaA_awesome_index(lua_State *L)
case A_TK_CONFFILE: case A_TK_CONFFILE:
lua_pushstring(L, globalconf.conffile); lua_pushstring(L, globalconf.conffile);
break; break;
case A_TK_FG:
luaA_pushcolor(L, &globalconf.colors.fg);
break;
case A_TK_BG:
luaA_pushcolor(L, &globalconf.colors.bg);
break;
default: default:
return 0; return 0;
} }
@ -789,6 +795,14 @@ luaA_awesome_newindex(lua_State *L)
globalconf.font = draw_font_new(newfont); globalconf.font = draw_font_new(newfont);
} }
break; 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: default:
return 0; return 0;
} }