diff --git a/libhyprcursor/hyprcursor.cpp b/libhyprcursor/hyprcursor.cpp index d1b992f..b33d9ae 100644 --- a/libhyprcursor/hyprcursor.cpp +++ b/libhyprcursor/hyprcursor.cpp @@ -128,7 +128,7 @@ static std::string getFullPathForThemeName(const std::string& name, PHYPRCURSORL const std::string NAME = std::any_cast(manifest->getConfigValue("name")); - if (NAME != name) + if (NAME != name && name != themeDir.path().stem().string()) continue; Debug::log(HC_LOG_INFO, logfn, "getFullPathForThemeName: found {}", themeDir.path().string()); @@ -146,18 +146,29 @@ static std::string getFullPathForThemeName(const std::string& name, PHYPRCURSORL if (!themeDir.is_directory()) continue; - if (!name.empty() && themeDir.path().stem().string() != name) - continue; - if (!themeAccessible(themeDir.path().string())) continue; const auto MANIFESTPATH = themeDir.path().string() + "/manifest.hl"; - if (std::filesystem::exists(MANIFESTPATH)) { - Debug::log(HC_LOG_INFO, logfn, "getFullPathForThemeName: found {}", themeDir.path().string()); - return std::filesystem::canonical(themeDir.path()).string(); - } + if (!std::filesystem::exists(MANIFESTPATH)) + continue; + + std::unique_ptr manifest; + try { + manifest = std::make_unique(MANIFESTPATH.c_str(), Hyprlang::SConfigOptions{}); + manifest->addConfigValue("name", Hyprlang::STRING{""}); + manifest->commence(); + manifest->parse(); + } catch (const char* e) { continue; } + + const std::string NAME = std::any_cast(manifest->getConfigValue("name")); + + if (NAME != name && name != themeDir.path().stem().string()) + continue; + + Debug::log(HC_LOG_INFO, logfn, "getFullPathForThemeName: found {}", themeDir.path().string()); + return std::filesystem::canonical(themeDir.path()).string(); } } diff --git a/tests/test.cpp b/tests/test.cpp index 0ba938c..aa1b026 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -11,7 +11,7 @@ void logFunction(enum eHyprcursorLogLevel level, char* message) { */ int main(int argc, char** argv) { - Hyprcursor::CHyprcursorManager mgr(nullptr, logFunction); + Hyprcursor::CHyprcursorManager mgr("classicFlatHypr", logFunction); if (!mgr.valid()) { std::cout << "mgr is invalid\n";