Unified window-rule store: query and mutate the rule set that maps windows to zones. Rules cross the wire as JSON strings — a single rule serializes to { id, name, enabled, priority, match, actions } and the whole set is a JSON object { _version, rules }. This interface serves the daemon's authoritative in-memory view of the rules, which is not the same as being the only writer of rules.json: the settings app writes that file in its own process on a reset, on a per-mode engine disable and on a config import, so every such out-of-process write has to be followed by reloadRules or the daemon keeps serving and re-persisting its pre-write set.
| Well-known name | org.plasmazones.Rules |
| Source XML | org.plasmazones.Rules.xml |
| Methods | 9 |
| Signals | 1 |
| Properties | 0 |
Return the whole rule set as a JSON object string ({ _version, rules }). Empty string if the store is unavailable.
| Arg | Direction | Type | Description |
|---|---|---|---|
rulesJson | out | s *(string)* | JSON object string in the { _version, rules } shape. |
Replace the entire rule set. The payload is a JSON object string in the { _version, rules } shape (or a bare object whose rules array carries the list). Individually malformed entries are dropped and a warning logs the dropped/accepted/total counts. A _version that is present and disagrees with the schema the daemon reads is refused outright rather than re-persisted under the daemon's own stamp; an absent _version is tolerated, since the bare-array spelling is a documented caller shape.
| Arg | Direction | Type | Description |
|---|---|---|---|
rulesJson | in | s *(string)* | JSON object string carrying the rules array. Payloads above roughly a million characters are refused at the wire boundary. |
ok | out | b *(bool)* | True only when the accepted set was both committed and written to disk. False covers an oversize payload, malformed JSON or a non-object document, a mismatched _version, a missing rules array, a non-empty payload whose every rule was dropped (treated as a rejected payload rather than a clear, so the persisted set survives), and an in-memory replace whose file write failed. A payload identical to the persisted set is a no-op that still returns true. |
Append one rule from its JSON object string. Returns false if the payload is over the roughly million-character wire cap, the JSON is malformed, the rule fails validation, its id collides with an existing rule, or the rules.json write failed.
| Arg | Direction | Type | Description |
|---|---|---|---|
ruleJson | in | s *(string)* | JSON object string for a single rule ({ id, name, enabled, priority, match, actions }). |
ok | out | b *(bool)* | True if the rule was added and the set was written to disk. |
Replace the rule with the same id from its JSON object string. Returns false if the payload is over the roughly million-character wire cap, the JSON is malformed, the rule fails validation, no rule with that id exists, or the rules.json write failed.
| Arg | Direction | Type | Description |
|---|---|---|---|
ruleJson | in | s *(string)* | JSON object string for a single rule ({ id, name, enabled, priority, match, actions }). |
ok | out | b *(bool)* | True if the rule was replaced and the set was written to disk. |
Remove the rule with the given id. Returns false if the id is malformed, no rule with that id exists, or the rules.json write failed.
| Arg | Direction | Type | Description |
|---|---|---|---|
ruleId | in | s *(string)* | Rule UUID string. |
ok | out | b *(bool)* | True if a rule was removed and the set was written to disk. |
Set the enabled flag of the rule with the given id. Returns false if the id is malformed, no rule with that id exists, or the rules.json write failed. Setting a rule to the flag it already carries is a no-op that still returns true.
| Arg | Direction | Type | Description |
|---|---|---|---|
ruleId | in | s *(string)* | Rule UUID string. |
enabled | in | b *(bool)* | True to enable the rule, false to disable it. |
ok | out | b *(bool)* | True if the rule now has the requested enabled state, whether or not this call is what put it there. |
Set the priority of the rule with the given id. Higher priority wins when multiple rules match a window. Returns false if the id is malformed, no rule with that id exists, or the rules.json write failed. Setting a rule to the priority it already carries is a no-op that still returns true.
| Arg | Direction | Type | Description |
|---|---|---|---|
ruleId | in | s *(string)* | Rule UUID string. |
priority | in | i *(int32)* | New priority value. |
ok | out | b *(bool)* | True if the rule now carries the requested priority, whether or not this call is what put it there. |
Global Restore Defaults hook for the rule store. Window border, title bar and gap defaults live in the config store now, so this creates nothing. It reloads the store from disk (to pick up an out-of-process write such as the settings app's own reset) and then strips any stale managed appearance baseline rules an older build left behind, preserving every user-authored rule. rulesChanged may fire up to twice, once for the reload and once for the strip. There is no return value, so a failed write of the stripped set is warned about in the daemon log and nowhere else: the caller is the global Restore Defaults, which is fire-and-forget and has nothing to do with a failure. The in-memory set is stripped either way, and the following rulesChanged carries persisted = false for a consumer that wants to know the disk copy diverged.
No arguments.
Re-read rules.json from disk. The daemon's rule store is borrowed, and reloadSettings does not reload a borrowed store, so an out-of-process rewrite of rules.json (a settings import, for one) leaves the daemon serving the old set until this is called. Idempotent, and rulesChanged is emitted only when the on-disk content differs from what the store already holds.
No arguments.
Emitted whenever the store's rule set changes (add, update, remove, enable, priority, or full replace).
| Arg | Direction | Type | Description |
|---|---|---|---|
persisted | out | b *(bool)* | True when the in-memory change was successfully written to disk. False signals an in-memory mutation whose persist failed — consumers can branch on this to differentiate 'saved' from 'edited but divergent from disk'. |