notify
Class info¶
🛈 DocStrings¶
Getting the user's attention outside the app: sounds, desktop and terminal notifications.
No Textual here: :class:~acptui.ui.app.AcpTui decides when (the agent asks for
permission or input, a turn ends, the agent fails) and calls these to do it. The sounds
are toad's (see NOTICE), resampled to keep the package small.
NotifyMethod
module-attribute
¶
Where notifications go: terminal escape sequences, the desktop's notification service
(desktop-notifier from acptui[notify], else notify-send / osascript), or the
desktop when it is reachable (a local session with a notifier), else the terminal.
Sound
module-attribute
¶
question: the agent waits for an answer; turn-over: the agent finished.
clean
¶
Text without control characters (they could end an escape sequence early).
desktop_notifier
¶
The command that shows desktop notifications here (None: none, or remote).
Source code in src/acptui/notify.py
desktop_notify
¶
Show a desktop notification with a command; whether it was shown (blocks).
Source code in src/acptui/notify.py
has_native_notifier
¶
is_remote
¶
Whether acptui runs over SSH (a desktop notification would pop up over there).
native_notify
async
¶
Show a notification with desktop-notifier (D-Bus, macOS notification center, WinRT).
Whether it was sent; False when the extra is not installed or the backend fails
(the caller falls back to :func:desktop_notify).
Source code in src/acptui/notify.py
notify_desktop
async
¶
A desktop notification: desktop-notifier if installed, else the notifier command.
Source code in src/acptui/notify.py
play_sound
¶
play_sound(sound: Sound) -> bool
Play a sound and wait until it ended (call it from a thread). Whether it played.
Source code in src/acptui/notify.py
sound_player
¶
A command line that plays a WAV file (the file is appended), if one is installed.
Source code in src/acptui/notify.py
terminal_notification
¶
Escape sequences that make the terminal show a notification.
OSC 777 (foot, WezTerm, Ghostty, Konsole, urxvt, VTE), OSC 9 (iTerm2, Windows Terminal, kitty, Ghostty) and OSC 99 (kitty); terminals ignore the ones they do not know. Agent text is cleaned of control characters first.
Source code in src/acptui/notify.py
terminal_title
¶
use_desktop
¶
use_desktop(method: NotifyMethod) -> bool
Whether notifications go to the desktop (else to the terminal).