layers: add fully featured animations

Adds configs and layerrules to handle them

alas fixes #981

I have cooked
This commit is contained in:
Vaxry
2024-02-28 15:00:34 +00:00
parent f4f3aa2e50
commit 4bc669f933
9 changed files with 197 additions and 42 deletions

View File

@@ -101,7 +101,7 @@ void CAnimationManager::tick() {
g_pHyprRenderer->damageWindow(w.get());
}
} else if (PLAYER) {
WLRBOXPREV = PLAYER->geometry;
WLRBOXPREV = CBox{PLAYER->realPosition.vec(), PLAYER->realSize.vec()};
PMONITOR = g_pCompositor->getMonitorFromVector(Vector2D(PLAYER->geometry.x, PLAYER->geometry.y) + Vector2D(PLAYER->geometry.width, PLAYER->geometry.height) / 2.f);
if (!PMONITOR)
continue;
@@ -513,6 +513,27 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config,
if (style == "loop" || style == "once")
return "";
return "unknown style";
} else if (config.starts_with("layers")) {
if (style == "fade" || style == "" || style == "slide")
return "";
else if (style.starts_with("popin")) {
// try parsing
float minPerc = 0.f;
if (style.find("%") != std::string::npos) {
try {
auto percstr = style.substr(style.find_last_of(' '));
minPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
} catch (std::exception& e) { return "invalid minperc"; }
return "";
}
minPerc; // fix warning
return "";
}
return "";
return "unknown style";
} else {
return "animation has no styles";
}