NAME

Chandra::Notify - Native OS desktop notifications

SYNOPSIS

use Chandra::Notify;

# Simple notification
Chandra::Notify->send(
    title => 'Download Complete',
    body  => 'report.pdf has finished downloading',
);

# With options
Chandra::Notify->send(
    title   => 'New Message',
    body    => 'Alice: Hey, are you there?',
    icon    => '/path/to/icon.png',
    sound   => 1,
    timeout => 5000,
);

# Check if supported
if (Chandra::Notify->is_supported) {
    Chandra::Notify->send(title => 'Hello', body => 'World');
}

DESCRIPTION

Chandra::Notify provides native desktop notifications across platforms:

  • macOS: Uses UNUserNotificationCenter (10.14+) or NSUserNotification

  • Linux: Uses libnotify if available, falls back to notify-send

  • Windows: Uses toast notifications (MessageBox as fallback)

METHODS

send(%args)

Send a notification. Returns true on success.

Arguments:

title - Notification title (required)
body - Notification body text
icon - Path to icon file
sound - Play default notification sound (1 = yes)
timeout - Auto-dismiss timeout in milliseconds (Linux/Windows)

is_supported()

Returns true if notifications are supported on this platform.

EXAMPLES

use Chandra::App;

my $app = Chandra::App->new(title => 'My App');

# Via app integration
$app->notify(
    title => 'Task Complete',
    body  => 'Build finished successfully',
);

PLATFORM NOTES

macOS

Requires macOS 10.8+ for NSUserNotification, 10.14+ for UNUserNotificationCenter. The app must be properly signed to display notifications in some cases.

Linux

Requires a notification daemon (most desktop environments have one). libnotify.so.4 is preferred; falls back to notify-send CLI.

Windows

Currently uses MessageBox as a fallback. Full toast notification support is planned for a future release.

SEE ALSO

Chandra, Chandra::App