lua: add awesome.conffile()

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-09-30 15:35:47 +02:00
parent caa63d43d7
commit 116de39142
2 changed files with 25 additions and 1 deletions

24
luaa.c
View File

@ -305,8 +305,22 @@ luaA_font(lua_State *L)
return 1;
}
/** Get configuration file path used by awesome.
* \param L The Lua VM state.
* \return The number of elements pushed on stack.
* \luastack
* \lreturn The awesome configuration file path.
*/
static int
luaA_conffile(lua_State *L)
{
lua_pushstring(L, globalconf.conffile);
return 1;
}
/** Set default colors. (DEPRECATED)
* \param L The Lua VM state.
* \return The number of elements pushed on stack.
*
* \luastack
* \lparam A table with `fg' and `bg' elements, containing colors.
@ -593,6 +607,7 @@ luaA_init(void)
{ "colors_set", luaA_colors_set },
{ "font", luaA_font },
{ "colors", luaA_colors },
{ "conffile", luaA_conffile },
{ NULL, NULL }
};
static const struct luaL_reg awesome_hooks_lib[] =
@ -703,8 +718,11 @@ luaA_parserc(const char *confpatharg)
if(luaL_dofile(globalconf.L, confpatharg))
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));
else
{
globalconf.conffile = a_strdup(confpatharg);
goto bailout;
}
}
confdir = getenv("XDG_CONFIG_HOME");
@ -733,7 +751,10 @@ luaA_parserc(const char *confpatharg)
if(luaL_dofile(globalconf.L, confpath))
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));
else
{
globalconf.conffile = a_strdup(confpath);
goto bailout;
}
xdg_config_dirs = getenv("XDG_CONFIG_DIRS");
@ -757,8 +778,11 @@ luaA_parserc(const char *confpatharg)
if(luaL_dofile(globalconf.L, confpath))
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));
else
{
globalconf.conffile = a_strdup(confpath);
break;
}
}
for(buf = xdg_files; *buf; buf++)
p_delete(buf);

View File

@ -405,7 +405,7 @@ struct awesome_t
/** Embedded windows */
xembed_window_t *embedded;
/** Path to config file */
char *configpath;
char *conffile;
/** Stack client history */
client_node_t *stack;
/** Command line passed to awesome */