| 1 |
## Notification API |
| 2 |
|
| 3 |
Displaying a desktop notification is done using the `pfd::notify` class. It can be provided a |
| 4 |
title, a message text, and an `icon` for the notification style: |
| 5 |
|
| 6 |
```cpp |
| 7 |
pfd::notify::notify(std::string const &title, |
| 8 |
std::string const &text, |
| 9 |
pfd::icon icon = pfd::icon::info); |
| 10 |
|
| 11 |
enum class pfd::icon { info, warning, error }; |
| 12 |
``` |
| 13 |
|
| 14 |
## Example |
| 15 |
|
| 16 |
Displaying a notification is straightforward. Emoji are supported: |
| 17 |
|
| 18 |
```cpp |
| 19 |
pfd::notify("System event", "Something might be on fire 🔥", |
| 20 |
pfd::icon::warning); |
| 21 |
``` |
| 22 |
|
| 23 |
The `pfd::notify` object needs not be kept around, letting the object clean up itself is enough. |
| 24 |
|
| 25 |
## Screenshots |
| 26 |
|
| 27 |
Windows 10: |
| 28 |
 |
| 29 |
|
| 30 |
Mac OS X (dark theme): |
| 31 |
 |
| 32 |
|
| 33 |
Mac OS X (light theme): |
| 34 |
 |
| 35 |
|
| 36 |
Linux (GNOME desktop): |
| 37 |
 |
| 38 |
|
| 39 |
Linux (KDE desktop): |
| 40 |
 |