Skip to main content

Module notify

Module notify 

Source
Expand description

Cross-platform notification backend.

Dispatches desktop notifications via platform-appropriate shell commands. Provides AutoNotifier which implements the crate::runner::Notifier trait and replaces the previous RealNotifier stub.

§Backend selection

detect tries backends in platform-specific order using which::which. An explicit override via [meta] notify_backend in .krypt.toml (or the --backend CLI flag) bypasses auto-detection.

§Backend commands

BackendCommand
notify-sendnotify-send <title> <body>
osascriptosascript -e 'display notification ...'
terminal-notifierterminal-notifier -title <title> -message <body>
powershellPowerShell [System.Windows.Forms.MessageBox]
stderreprintln!("notice: {title} — {body}")

§PowerShell strategy

BurntToast requires a third-party module install (Install-Module BurntToast) which most users won’t have. Instead we use System.Windows.Forms.MessageBox which ships in every .NET installation. Values are passed via $env:KRYPT_NOTIFY_TITLE / $env:KRYPT_NOTIFY_BODY environment variables to avoid PowerShell single-quote escaping entirely.

Structs§

AutoNotifier
Production notifier backed by a detected or configured NotifyBackend.

Enums§

NotifyBackend
Available notification backends.
NotifyError
Errors that can occur while dispatching a notification.

Functions§

command_for
Build the command + args for a given backend without spawning.
detect
Detect the best available notification backend.
escape_applescript
Escape a string for use inside an AppleScript double-quoted string.
notify
Send a desktop notification using the specified backend.