6#include <QLatin1StringView>
15#include "phosphorrules_export.h"
80 return !(*
this == other);
87 static std::optional<RuleAction>
fromJson(
const QJsonObject& obj);
130 std::optional<double>
min{};
131 std::optional<double>
max{};
171inline constexpr QLatin1StringView
Effect{
"effect"};
185inline constexpr QLatin1StringView
Border{
"border"};
186inline constexpr QLatin1StringView
Animation{
"animation"};
188inline constexpr QLatin1StringView
Gap{
"gap"};
193inline constexpr QLatin1StringView
Overlay{
"overlay"};
277class PHOSPHORRULES_EXPORT ActionRegistry
299 std::optional<ActionDescriptor>
descriptor(
const QString& type)
const;
322 bool hasTag(
const QString& type, QLatin1StringView tag)
const;
342 void registerBuiltins();
349 void registerBuiltinsEngine();
350 void registerBuiltinsAppearance();
351 void registerBuiltinsIndicators();
353 QHash<QString, ActionDescriptor> m_descriptors;
379 const std::function<
bool(
const QString& event)>& eventIsLive);
static ActionRegistry & instance()
The shared process-wide registry, pre-populated with the built-ins.
bool hasTag(const QString &type, QLatin1StringView tag) const
True if the descriptor for type carries tag.
QString paramKeyOfKind(const QString &type, QLatin1StringView kind) const
The wire param key whose schema kind is kind for type, or an empty string when type declares no such ...
bool isRegistered(const QString &type) const
True if type names a registered action.
QStringList registeredTypes() const
All registered type ids — for UI enumeration / tests.
bool validate(const RuleAction &action) const
True if action passes its descriptor's validation.
std::optional< ActionDescriptor > descriptor(const QString &type) const
The descriptor for type, or nullopt if unregistered.
bool unregisterAction(const QString &type)
Remove a previously-registered descriptor.
QString slotFor(const RuleAction &action) const
The slot a concrete action resolves to, or an empty string if the type is unregistered or its descrip...
ActionDomain domainFor(const RuleAction &action) const
The evaluation domain action contributes to, or ActionDomain::Window for an unregistered type (the co...
QStringList typesWithTag(QLatin1StringView tag) const
All registered type ids whose descriptor carries tag.
void registerAction(const ActionDescriptor &descriptor)
Register (or replace) a descriptor.
bool isTerminal(const RuleAction &action) const
True if action is a terminal action (one of the Exclude family).
Definition RuleAction.h:160
constexpr QLatin1StringView Animation
Definition RuleAction.h:186
constexpr QLatin1StringView Effect
Actions consumed by the KWin effect's rule set (shader manager + border appearance + window stacking ...
Definition RuleAction.h:171
constexpr QLatin1StringView Border
Definition RuleAction.h:185
constexpr QLatin1StringView Gap
Definition RuleAction.h:188
constexpr QLatin1StringView Overlay
Context-domain overlay-property overrides (overlay shader / style).
Definition RuleAction.h:193
constexpr QLatin1StringView LayoutEngine
Definition RuleAction.h:187
constexpr QLatin1StringView EffectVerdict
Effect-consumed one-shot verdicts that are NOT appearance overrides and must not be cancelled by Excl...
Definition RuleAction.h:184
Definition ActionParams.h:25
PHOSPHORRULES_EXPORT bool ruleHasLiveEffectAction(const QList< RuleAction > &actions, const std::function< bool(const QString &event)> &eventIsLive)
True when actions carry at least one Tag::Effect action that can actually take effect,...
@ Context
resolvable during a windowless context query (screen / desktop / activity / mode / screen orientation...
Definition MatchTypes.h:201
@ Window
absent during windowless context queries
Definition MatchTypes.h:200
ActionDomain
Which evaluation pass an action contributes to.
Definition RuleAction.h:46
@ Window
fills slots consumed by per-window evaluation
Definition RuleAction.h:48
Static metadata describing one registered action type.
Definition RuleAction.h:216
QStringList allowedKeys
The complete set of param keys this action type accepts.
Definition RuleAction.h:240
SlotResolver slotFor
Resolves the slot for a concrete action's params.
Definition RuleAction.h:227
Validator validate
Returns true if params is a well-formed payload for this type.
Definition RuleAction.h:229
int displayOrder
Intended sort key within a category (lower = earlier).
Definition RuleAction.h:262
QList< ParamSchema > params
Structural per-param schema consumed by the editor UI.
Definition RuleAction.h:249
QString type
the action type id
Definition RuleAction.h:224
std::function< bool(const QJsonObject ¶ms)> Validator
Definition RuleAction.h:222
bool terminal
Terminal actions (the Exclude family: Exclude / ExcludePlacement / ExcludeAnimations / ExcludeDecorat...
Definition RuleAction.h:234
QStringList tags
Behavioural tags for consumer-side filtering.
Definition RuleAction.h:266
ActionDomain domain
Which evaluation pass the action contributes to — see ActionDomain.
Definition RuleAction.h:245
QString category
UI grouping category for the action-type picker.
Definition RuleAction.h:258
bool userAuthorable
True when the action should appear in the editor's "add rule" type picker.
Definition RuleAction.h:255
std::function< QString(const QJsonObject ¶ms)> SlotResolver
Function shape that resolves the slot for a concrete action's params.
Definition RuleAction.h:221
Structural schema for one action param.
Definition RuleAction.h:127
std::optional< double > max
inclusive upper bound, in display units
Definition RuleAction.h:131
QStringList enumWireValues
wire values for kind == "enum"; empty otherwise
Definition RuleAction.h:140
QString key
wire param key in RuleAction::params
Definition RuleAction.h:128
std::optional< double > min
inclusive lower bound, in display units
Definition RuleAction.h:130
QString kind
UI kind hint — see struct doc.
Definition RuleAction.h:129
std::optional< double > defaultDisplay
Initial display-unit value for the editor when a fresh rule is created.
Definition RuleAction.h:139
std::optional< double > scale
stored = display * scale; nullopt for unscaled kinds
Definition RuleAction.h:132
One action carried by a Rule.
Definition RuleAction.h:65
QJsonObject toJson() const
bool operator==(const RuleAction &other) const
Definition RuleAction.h:74
static std::optional< RuleAction > fromJson(const QJsonObject &obj)
Strict loader — validates against the ActionRegistry; returns nullopt for an unregistered type or par...
bool operator!=(const RuleAction &other) const
Definition RuleAction.h:78
QJsonObject params
Action-specific payload.
Definition RuleAction.h:72
QString type
registered action type id (e.g.
Definition RuleAction.h:66