protocol
protocol
¶
PEP 544 protocol defining the Notifier interface.
Notifier
¶
Bases: Protocol
Structural type for desktop notification backends.
Implementations must provide notify, on_action, close, and
disconnect. DbusNotifier talks to a real session bus;
NullNotifier silently discards everything for headless environments.
notify(summary, body='', *, actions=(), timeout_ms=-1, hints=None, replaces_id=0, app_icon='', container_id='', container_name='', project='', task_id='', task_name='')
async
¶
Send a desktop notification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
summary
|
str
|
Notification title. |
required |
body
|
str
|
Optional body text. |
''
|
actions
|
Sequence[tuple[str, str]]
|
|
()
|
timeout_ms
|
int
|
Expiration hint in milliseconds ( |
-1
|
hints
|
Mapping[str, Any] | None
|
Freedesktop hint dict (values are |
None
|
replaces_id
|
int
|
Replace an existing notification in-place. |
0
|
app_icon
|
str
|
Icon name or |
''
|
container_id
|
str
|
Presentation-layer hint: the 12-char podman
container ID the event refers to. The desktop
|
''
|
container_name
|
str
|
Podman |
''
|
project
|
str
|
Terok project slug when the container is orchestrator-
managed (from the |
''
|
task_id
|
str
|
Terok task ID ( |
''
|
task_name
|
str
|
Human-readable task label from terok's metadata — mutable at any point in the task's life, so resolved live by callers, not snapshotted. Empty when unknown. |
''
|
Returns:
| Type | Description |
|---|---|
int
|
Server-assigned notification ID ( |
Source code in src/terok_clearance/notifications/protocol.py
on_action(notification_id, callback)
async
¶
Register a callback for when the user clicks an action button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
notification_id
|
int
|
ID returned by |
required |
callback
|
Callable[[str], None]
|
Called with the |
required |