mirror of
https://github.com/hyprwm/hyprcursor.git
synced 2024-11-17 02:35:57 +01:00
parent
96a015fc20
commit
05db7dfd7f
1 changed files with 20 additions and 0 deletions
|
@ -26,6 +26,20 @@ static std::string themeNameFromEnv() {
|
||||||
return std::string{ENV};
|
return std::string{ENV};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool themeAccessible(const std::string& path) {
|
||||||
|
try {
|
||||||
|
if (!std::filesystem::exists(path + "/manifest.hl"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const auto MANIFESTSTATUS = std::filesystem::status(path + "/manifest.hl");
|
||||||
|
if ((MANIFESTSTATUS.permissions() & std::filesystem::perms::others_read) == std::filesystem::perms::none)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} catch (std::exception& e) { return false; }
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static std::string getFirstTheme() {
|
static std::string getFirstTheme() {
|
||||||
// try user directories first
|
// try user directories first
|
||||||
|
|
||||||
|
@ -112,6 +126,9 @@ static std::string getFullPathForThemeName(const std::string& name) {
|
||||||
if (!name.empty() && themeDir.path().stem().string() != name)
|
if (!name.empty() && themeDir.path().stem().string() != name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!themeAccessible(themeDir.path().string()))
|
||||||
|
continue;
|
||||||
|
|
||||||
const auto MANIFESTPATH = themeDir.path().string() + "/manifest.hl";
|
const auto MANIFESTPATH = themeDir.path().string() + "/manifest.hl";
|
||||||
|
|
||||||
if (std::filesystem::exists(MANIFESTPATH))
|
if (std::filesystem::exists(MANIFESTPATH))
|
||||||
|
@ -497,6 +514,9 @@ General
|
||||||
|
|
||||||
std::optional<std::string> CHyprcursorImplementation::loadTheme() {
|
std::optional<std::string> CHyprcursorImplementation::loadTheme() {
|
||||||
|
|
||||||
|
if (!themeAccessible(themeFullDir))
|
||||||
|
return "Theme inaccessible";
|
||||||
|
|
||||||
currentTheme = &theme;
|
currentTheme = &theme;
|
||||||
|
|
||||||
// load manifest
|
// load manifest
|
||||||
|
|
Loading…
Reference in a new issue