mirror of
https://github.com/hyprwm/hyprcursor.git
synced 2024-11-16 18:25:58 +01:00
lib: fixup theme name matching
This commit is contained in:
parent
44d46e45a1
commit
1a1fcfb58d
2 changed files with 20 additions and 9 deletions
|
@ -128,7 +128,7 @@ static std::string getFullPathForThemeName(const std::string& name, PHYPRCURSORL
|
|||
|
||||
const std::string NAME = std::any_cast<Hyprlang::STRING>(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<Hyprlang::CConfig> manifest;
|
||||
try {
|
||||
manifest = std::make_unique<Hyprlang::CConfig>(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<Hyprlang::STRING>(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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue