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
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

18
luaa.c
View File

@ -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;
}