furnace/extern/pfd-fixed/doc/notify.md

1.3 KiB

Notification API

Displaying a desktop notification is done using the pfd::notify class. It can be provided a title, a message text, and an icon for the notification style:

pfd::notify::notify(std::string const &title,
                    std::string const &text,
                    pfd::icon icon = pfd::icon::info);

enum class pfd::icon { info, warning, error };

Example

Displaying a notification is straightforward. Emoji are supported:

pfd::notify("System event", "Something might be on fire 🔥",
            pfd::icon::warning);

The pfd::notify object needs not be kept around, letting the object clean up itself is enough.

Screenshots

Windows 10: notify-win32

Mac OS X (dark theme): image

Mac OS X (light theme): image

Linux (GNOME desktop): notify-gnome

Linux (KDE desktop): notify-kde