mirror of
https://github.com/NCBM/plyngent.git
synced 2026-11-07 07:17:54 +08:00
b7044bbba7
A prompt notification went out with the library defaults: the notification server's own expiry. A desktop server drops such a notification after a few seconds, so the announcement of a blocked turn had usually slid into the notification tray by the time the human looked back. It now goes out without expiry (`timeout=0`, the freedesktop value for "until dismissed"). Urgency is left alone: measured on KDE Plasma, `critical` keeps the notification up just the same, but paints it as urgent and asks the platform's Focus mode to let it through — decoration a prompt does not need. Dismissing is already the prompt's own job once it is answered, so nothing lingers.
72 lines
1.8 KiB
Python
72 lines
1.8 KiB
Python
# Minimal stubs for the optional ``desktop-notifier`` extra.
|
|
# Only the surface ``plyngent.cli.notify`` uses is declared; the real package is
|
|
# installed with ``pip install plyngent[notify]`` and is absent by default.
|
|
|
|
from collections.abc import Sequence
|
|
from enum import Enum
|
|
from typing import Any
|
|
|
|
class Capability(Enum):
|
|
APP_NAME = ...
|
|
TITLE = ...
|
|
MESSAGE = ...
|
|
URGENCY = ...
|
|
ICON = ...
|
|
BUTTONS = ...
|
|
REPLY_FIELD = ...
|
|
ATTACHMENT = ...
|
|
ON_DISPATCHED = ...
|
|
ON_CLICKED = ...
|
|
ON_DISMISSED = ...
|
|
SOUND = ...
|
|
THREAD = ...
|
|
TIMEOUT = ...
|
|
|
|
class Urgency(Enum):
|
|
Critical = ...
|
|
Normal = ...
|
|
Low = ...
|
|
|
|
class Button:
|
|
def __init__(
|
|
self,
|
|
title: str,
|
|
on_pressed: Any = None,
|
|
identifier: str | None = None,
|
|
) -> None: ...
|
|
|
|
class ReplyField:
|
|
def __init__(
|
|
self,
|
|
title: str = ...,
|
|
button_title: str = ...,
|
|
on_replied: Any = None,
|
|
) -> None: ...
|
|
|
|
class DesktopNotifier:
|
|
def __init__(
|
|
self,
|
|
app_name: str = ...,
|
|
app_icon: Any = ...,
|
|
notification_limit: int | None = None,
|
|
) -> None: ...
|
|
async def get_capabilities(self) -> frozenset[Capability]: ...
|
|
async def send(
|
|
self,
|
|
title: str,
|
|
message: str,
|
|
urgency: Urgency = ...,
|
|
icon: Any = ...,
|
|
buttons: Sequence[Button] = ...,
|
|
reply_field: ReplyField | None = None,
|
|
on_dispatched: Any = None,
|
|
on_clicked: Any = None,
|
|
on_dismissed: Any = None,
|
|
attachment: Any = ...,
|
|
sound: Any = ...,
|
|
thread: str | None = None,
|
|
timeout: int = -1, # noqa: ASYNC109 - the library's own parameter name
|
|
) -> str: ...
|
|
async def clear(self, identifier: str) -> None: ...
|
|
async def clear_all(self) -> None: ...
|