Add "Always" condition type to profiles
- Add AlwaysCondition model and evaluation (always returns true) - Add condition type selector (Always/Application) in profile editor - Show condition type pill on profile cards - Fix misleading empty-conditions text (was "never activate", actually always active) - Add i18n keys for Always condition (en + ru) - Add CSS for condition type selector and description Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,11 +18,24 @@ class Condition:
|
||||
def from_dict(cls, data: dict) -> "Condition":
|
||||
"""Factory: dispatch to the correct subclass."""
|
||||
ct = data.get("condition_type", "")
|
||||
if ct == "always":
|
||||
return AlwaysCondition.from_dict(data)
|
||||
if ct == "application":
|
||||
return ApplicationCondition.from_dict(data)
|
||||
raise ValueError(f"Unknown condition type: {ct}")
|
||||
|
||||
|
||||
@dataclass
|
||||
class AlwaysCondition(Condition):
|
||||
"""Always-true condition — profile activates unconditionally when enabled."""
|
||||
|
||||
condition_type: str = "always"
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict) -> "AlwaysCondition":
|
||||
return cls()
|
||||
|
||||
|
||||
@dataclass
|
||||
class ApplicationCondition(Condition):
|
||||
"""Activate when specified applications are running or topmost."""
|
||||
|
||||
Reference in New Issue
Block a user