diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 8704e4586..d4f55a80b 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -377,12 +377,6 @@ if(DO_COVERAGE) ${BUILD_DIR}/${file} COPYONLY) endforeach() - - # There is no way to avoid that one - configure_file(${SOURCE_DIR}/lib/awful/util.lua - ${BUILD_DIR}/lib/awful/util.lua - ESCAPE_QUOTES - @ONLY) else() foreach(file ${AWESOME_CONFIGURE_COPYONLY_WITHCOV_FILES}) configure_file(${SOURCE_DIR}/${file} diff --git a/config.h b/config.h index b599a90ed..b6c637b70 100644 --- a/config.h +++ b/config.h @@ -4,6 +4,8 @@ #define AWESOME_LUA_LIB_PATH "@AWESOME_LUA_LIB_PATH@" #define XDG_CONFIG_DIR "@XDG_CONFIG_DIR@" #define AWESOME_IS_BIG_ENDIAN @AWESOME_IS_BIG_ENDIAN@ +#define AWESOME_THEMES_PATH "@AWESOME_THEMES_PATH@" +#define AWESOME_ICON_PATH "@AWESOME_ICON_PATH@" #cmakedefine WITH_DBUS #cmakedefine HAS_EXECINFO diff --git a/lib/awful/util.lua b/lib/awful/util.lua index 0b754360f..5cc962683 100644 --- a/lib/awful/util.lua +++ b/lib/awful/util.lua @@ -200,13 +200,13 @@ end --- Get the path to the directory where themes are installed. -- @return A string with the requested path with a slash at the end. function util.get_themes_dir() - return (os.getenv('AWESOME_THEMES_PATH') or "@AWESOME_THEMES_PATH@") .. "/" + return (os.getenv('AWESOME_THEMES_PATH') or awesome.themes_path) .. "/" end --- Get the path to the directory where our icons are installed. -- @return A string with the requested path with a slash at the end. function util.get_awesome_icon_dir() - return (os.getenv('AWESOME_ICON_PATH') or "@AWESOME_ICON_PATH@") .. "/" + return (os.getenv('AWESOME_ICON_PATH') or awesome.icon_path) .. "/" end --- Get the user's config or cache dir. diff --git a/luaa.c b/luaa.c index cfacd8b87..94ed248bd 100644 --- a/luaa.c +++ b/luaa.c @@ -352,6 +352,16 @@ luaA_fixups(lua_State *L) * @tfield string hostname */ +/** + * The path where themes were installed to. + * @tfield string themes_path + */ + +/** + * The path where icons were installed to. + * @tfield string icon_path + */ + static int luaA_awesome_index(lua_State *L) { @@ -409,6 +419,18 @@ luaA_awesome_index(lua_State *L) return 1; } + if(A_STREQ(buf, "themes_path")) + { + lua_pushliteral(L, AWESOME_THEMES_PATH); + return 1; + } + + if(A_STREQ(buf, "icon_path")) + { + lua_pushliteral(L, AWESOME_ICON_PATH); + return 1; + } + return luaA_default_index(L); }