A "when X then Y" automation engine for Omarchy v4 ("Quattro"): your desktop reacts to what you are doing — screensharing, gaming, the hour, the power source — without you touching a toggle.
While a trigger holds, its actions are asserted; when it clears, the engine restores each actuator to exactly the state it had before the rule fired. If you had DND on before a screenshare started, it stays on after the call ends.
when |
Fires while… | Extra fields |
|---|---|---|
screenshare |
any app is casting the screen (Hyprland screencast event) |
|
window-class |
the focused window's app id matches an anchored regex | match |
time |
the clock is inside a window (may wrap midnight) | from, to ("HH:MM") |
on-battery |
the machine runs on battery (UPower) |
dnd, night-light, stay-awake, game-mode (shared flag with
community.game-mode),
power-profile:performance / power-profile:balanced /
power-profile:power-saver.
~/.config/omarchy/context-rules.json — watched, so edits apply
immediately, no restart. With no file, one safe default applies:
screenshare → DND + stay awake.
{
"rules": [
{ "when": "screenshare", "do": ["dnd", "stay-awake"] },
{ "when": "window-class", "match": "steam_app_.*|gamescope", "do": ["game-mode", "power-profile:performance"] },
{ "when": "time", "from": "21:00", "to": "07:00", "do": ["night-light"] }
]
}Invalid rules are dropped; {"rules": []} disables everything explicitly.
The optional bar widget () is lit while any rule is asserting, dimmed
while the engine is paused; clicking pauses/resumes the engine (persisted
in ~/.local/state/omarchy/settings/context-rules.json). Scriptable:
omarchy-shell community.context-rules status | enable | disableomarchy plugin add https://github.com/devmobasa/omarchy-context-rules --enable- Omarchy's battery service already switches power profiles on AC/battery
changes. An
on-battery→power-profile:*rule will contend with it; prefer leaving power profiles to rules that key on something else (like a game launching). - Restores happen from an in-memory snapshot. If the shell restarts while a rule is asserted, the engine re-asserts on startup but the pre-rule snapshot is gone — it will then restore to the asserted value. Rare and self-corrects the next time you flip the control by hand.
window-classmatches the Wayland app id of the focused window (hyprctl clients.classfor native windows).
./test/all # node model + contract + static QML checks, manifest, qmllint