One per-window animation override entry. More...
#include <phosphor-animation/include/PhosphorAnimation/AnimationAppRule.h>
Public Types | |
| enum class | Kind { Shader , Timing } |
Public Member Functions | |
| bool | operator== (const AnimationAppRule &other) const noexcept |
| bool | operator!= (const AnimationAppRule &other) const noexcept |
| QJsonObject | toJson () const |
Static Public Member Functions | |
| static std::optional< AnimationAppRule > | fromJson (const QJsonObject &obj) |
| Strict rule-level loader. | |
Public Attributes | |
| QString | classPattern |
Substring matched case-insensitively against EffectWindow::windowClass() (or the equivalent in the daemon path). | |
| QString | eventPath |
Animation event path from PhosphorAnimation::ProfilePaths::Window* (e.g. | |
| Kind | kind = Kind::Shader |
| QString | effectId |
| Shader effect id from the registry. | |
| QVariantMap | shaderParams |
| Per-effect parameter map (same shape as the per-event tree). | |
| QString | curve |
Easing curve string in Profile's wire format ("x1,y1,x2,y2", "elastic-out:amp,per", "spring:omega,zeta", etc.). | |
| int | durationMs = 0 |
| Duration override in milliseconds. | |
One per-window animation override entry.
Sits alongside the per-event ShaderProfileTree in the same org.plasmazones.settings config namespace. Where the tree provides a global default per event path (e.g. "every window-open uses
pop-in"), an AnimationAppRule overrides that default for a specific window-class pattern (e.g. "firefox uses dissolve, but
everything else stays pop-in").
eventPath only. To override the same pattern across multiple events, write a separate rule per event.Shader override OR a Timing override, not both. Override both for the same (pattern, eventPath) by writing two rules.kind matches the requested axis).effectId in a Shader rule = engaged-blocking sentinel: "no animation for this app on this event," winning over the per-event default.Resolution at window-event time is:
AnimationAppRuleList::resolve{Shader,Timing}(windowClass, eventPath) — first matching rule of that axis. If hit, done.Settings::shaderProfileTree.resolve(eventPath) — the user's per-event override, if engaged.ShaderProfile).The rule layer wins over the per-event override. If a user has configured both, they intended the per-app rule to take precedence on matching windows.
|
strong |
|
static |
Strict rule-level loader.
Returns nullopt when the JSON is missing required fields, names an unknown kind, or carries an empty classPattern / eventPath — none of which can produce a valid rule. Direct callers (tests, ad-hoc round-trips, future scripting hooks) get the same drop-on-malformed contract the list-level loader already applies, so a typo in kind can't silently materialise as an engaged-empty-effectId Shader rule that would block animations for matching windows.
The kind field is parsed case-insensitively on read (so "Shader", "shader", "SHADER" all map to Kind::Shader) and emitted lowercase via toJson — direct round-trip is stable for the canonical form, but hand-edited capitalised values normalise on first save.
The durationMs Timing-kind sentinel covers <= 0 — negative values are accepted on read but emit as the absent-key form via toJson, so a negative in-memory value will round-trip through disk as 0. Callers should normalise to 0 if they want strict equality across a save/load cycle.
|
inlinenoexcept |
|
noexcept |
| QJsonObject PhosphorAnimationShaders::AnimationAppRule::toJson | ( | ) | const |
| QString PhosphorAnimationShaders::AnimationAppRule::classPattern |
Substring matched case-insensitively against EffectWindow::windowClass() (or the equivalent in the daemon path).
Empty pattern matches nothing — the resolver short-circuits, so an accidentally-empty pattern can't accidentally swallow every window.
| QString PhosphorAnimationShaders::AnimationAppRule::curve |
Easing curve string in Profile's wire format ("x1,y1,x2,y2", "elastic-out:amp,per", "spring:omega,zeta", etc.).
Empty string means "use per-event default."
| int PhosphorAnimationShaders::AnimationAppRule::durationMs = 0 |
Duration override in milliseconds.
Zero (or negative) means "use per-event default."
| QString PhosphorAnimationShaders::AnimationAppRule::effectId |
Shader effect id from the registry.
Empty string means "engaged- blocking sentinel" — the rule disables the per-event default shader for matching windows without falling through to it.
| QString PhosphorAnimationShaders::AnimationAppRule::eventPath |
Animation event path from PhosphorAnimation::ProfilePaths::Window* (e.g.
"window.open", "window.close"). Exact equality match — rule only applies to the named event.
| Kind PhosphorAnimationShaders::AnimationAppRule::kind = Kind::Shader |
| QVariantMap PhosphorAnimationShaders::AnimationAppRule::shaderParams |
Per-effect parameter map (same shape as the per-event tree).
Stored as QVariantMap so the JSON round-trip is straightforward; consumers translate via AnimationShaderRegistry::translateAnimationParams at resolution time.