notify-rust 4.18.0

Show desktop notifications (linux, bsd, mac). Pure Rust dbus client and server.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
#[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
use mac_usernotifications::InterruptionLevel;

#[cfg(all(unix, not(target_os = "macos")))]
use crate::{
    hints::{CustomHintType, Hint},
    urgency::Urgency,
    xdg,
};

#[cfg(all(unix, not(target_os = "macos"), feature = "images_no_default_features"))]
use crate::image::Image;

#[cfg(all(unix, target_os = "macos"))]
use crate::macos;
#[cfg(target_os = "windows")]
use crate::{windows, Urgency};

use crate::{error::*, timeout::Timeout};

#[cfg(all(unix, not(target_os = "macos")))]
use std::collections::{HashMap, HashSet};

// Returns the name of the current executable, used as a default for `Notification.appname`.
fn exe_name() -> String {
    std::env::current_exe()
        .unwrap()
        .file_name()
        .unwrap()
        .to_str()
        .unwrap()
        .to_owned()
}

/// Desktop notification.
///
/// A desktop notification is configured via builder pattern, before it is launched with `show()`.
///
/// # Example
/// ``` no_run
/// # use notify_rust::*;
/// # fn _doc() -> Result<(), Box<dyn std::error::Error>> {
///     Notification::new()
///         .summary("☝️ A notification")
///         .show()?;
/// # Ok(())
/// # }
/// ```
#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct Notification {
    /// Filled by default with the executable name.
    pub appname: String,

    /// Single line to summarize the content.
    pub summary: String,

    /// Subtitle for macOS.
    pub subtitle: Option<String>,

    /// Multiple lines possible, may support simple markup.
    /// Check out [`get_capabilities()`](crate::get_capabilities) -> `body-markup` and `body-hyperlinks`.
    pub body: String,

    /// Use a `file://` URI or a name in an icon theme, must be compliant with freedesktop.org.
    pub icon: String,

    /// Check out [`Hint`].
    ///
    /// # Warning
    /// This does not hold all hints. [`Hint::Custom`] and [`Hint::CustomInt`] are held elsewhere.
    // /// please access hints via [`Notification::get_hints`].
    #[cfg(all(unix, not(target_os = "macos")))]
    pub hints: HashSet<Hint>,

    #[cfg(all(unix, not(target_os = "macos")))]
    pub(crate) hints_unique: HashMap<(String, CustomHintType), Hint>,

    /// See [`Notification::actions()`] and [`Notification::action()`].
    pub actions: Vec<String>,

    #[cfg(target_os = "macos")]
    pub(crate) sound_name: Option<String>,

    #[cfg(target_os = "windows")]
    pub(crate) sound_name: Option<String>,

    #[cfg(any(target_os = "windows", target_os = "macos"))]
    pub(crate) path_to_image: Option<String>,

    #[cfg(target_os = "windows")]
    pub(crate) app_id: Option<String>,

    #[cfg(target_os = "windows")]
    pub(crate) urgency: Option<Urgency>,

    #[cfg(all(unix, not(target_os = "macos")))]
    pub(crate) bus: xdg::NotificationBus,

    /// Lifetime of the notification in ms. Often not respected by the server.
    pub timeout: Timeout, // both gnome and galago want allow for -1

    /// Interruption level (macOS only; has effect with the `preview-macos-un` feature).
    #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
    pub(crate) interruption_level: Option<InterruptionLevel>,

    /// Only to be used on the receive end. Use [`NotificationHandle`](crate::NotificationHandle) for updating.
    #[cfg(not(all(target_os = "macos", feature = "preview-macos-un")))]
    pub(crate) id: Option<u32>,

    /// Notification identifier for the macOS UN backend.
    #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
    pub(crate) id: Option<crate::notification_id::NotificationId>,
}

impl Notification {
    /// Constructs a new Notification.
    ///
    /// Most fields are empty by default, only `appname` is initialized with the name of the current
    /// executable.
    ///
    /// The `appname` is used by some desktop environments to group notifications.
    pub fn new() -> Notification {
        Notification::default()
    }

    /// This is for testing purposes only and will not work with actual implementations.
    #[cfg(all(unix, not(target_os = "macos")))]
    #[doc(hidden)]
    #[deprecated(note = "this is a test only feature")]
    pub fn at_bus(sub_bus: &str) -> Notification {
        let bus = xdg::NotificationBus::custom(sub_bus)
            .ok_or("invalid subpath")
            .unwrap();
        Notification {
            bus,
            ..Notification::default()
        }
    }

    /// Overwrite the `appname` field used for the notification.
    ///
    /// # Platform Support
    /// This method has no effect on macOS. There you can only set the application via [`set_application()`](fn.set_application.html).
    pub fn appname(&mut self, appname: &str) -> &mut Notification {
        appname.clone_into(&mut self.appname);
        self
    }

    /// Set the `summary`.
    ///
    /// Often acts as the title of the notification. For more elaborate content use the `body` field.
    pub fn summary(&mut self, summary: &str) -> &mut Notification {
        summary.clone_into(&mut self.summary);
        self
    }

    /// Set the `subtitle`.
    ///
    /// Only useful on macOS. Not part of the XDG specification.
    pub fn subtitle(&mut self, subtitle: &str) -> &mut Notification {
        self.subtitle = Some(subtitle.to_owned());
        self
    }

    /// Manual wrapper for [`Hint::ImageData`].
    #[cfg(all(feature = "images_no_default_features", unix, not(target_os = "macos")))]
    pub fn image_data(&mut self, image: Image) -> &mut Notification {
        self.hint(Hint::ImageData(image));
        self
    }

    /// Sets the image path for the notification.
    ///
    /// The path is passed to the platform's native notification API directly — no additional
    /// dependencies or crate features are required.
    ///
    /// Platform behaviour:
    /// - **Linux/BSD (XDG):** maps to the `image-path` hint in the D-Bus notification spec.
    /// - **macOS:** maps to `content_image` in `mac-notification-sys`, displayed on the right
    ///   side of the notification banner.
    /// - **Windows:** passed directly to `winrt-notification` as the notification image.
    pub fn image_path(&mut self, path: &str) -> &mut Notification {
        #[cfg(all(unix, not(target_os = "macos")))]
        {
            self.hint(Hint::ImagePath(path.to_string()));
        }
        #[cfg(any(target_os = "macos", target_os = "windows"))]
        {
            self.path_to_image = Some(path.to_string());
        }
        self
    }

    /// Sets the app's `System.AppUserModel.ID`.
    #[cfg(target_os = "windows")]
    pub fn app_id(&mut self, app_id: &str) -> &mut Notification {
        self.app_id = Some(app_id.to_string());
        self
    }

    /// Wrapper for [`Hint::ImageData`].
    #[cfg(all(feature = "images_no_default_features", unix, not(target_os = "macos")))]
    pub fn image<T: AsRef<std::path::Path> + Sized>(
        &mut self,
        path: T,
    ) -> Result<&mut Notification> {
        let img = Image::open(&path)?;
        self.hint(Hint::ImageData(img));
        Ok(self)
    }

    /// Wrapper for [`Hint::SoundName`].
    #[cfg(all(unix, not(target_os = "macos")))]
    pub fn sound_name(&mut self, name: &str) -> &mut Notification {
        self.hint(Hint::SoundName(name.to_owned()));
        self
    }

    /// Set the `sound_name` for the `NSUserNotification`.
    #[cfg(any(target_os = "macos", target_os = "windows"))]
    pub fn sound_name(&mut self, name: &str) -> &mut Notification {
        self.sound_name = Some(name.to_owned());
        self
    }

    /// Set the interruption level (macOS only; has effect with the `preview-macos-un` feature).
    ///
    /// Controls whether the notification breaks through Focus modes on macOS 12+.
    ///
    /// # Platform support
    ///
    /// This method is only available on macOS when the `preview-macos-un` feature is enabled.
    /// For a more cross-platform alternative, use `.urgency()`, which is automatically converted to the appropriate `InterruptionLevel` on macOS.
    #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
    pub fn interruption_level(&mut self, level: InterruptionLevel) -> &mut Notification {
        self.interruption_level = Some(level);
        self
    }

    /// Set the content of the `body` field.
    ///
    /// Multiline textual content of the notification.
    /// Each line should be treated as a paragraph.
    /// Simple html markup should be supported, depending on the server implementation.
    pub fn body(&mut self, body: &str) -> &mut Notification {
        body.clone_into(&mut self.body);
        self
    }

    /// Set the `icon` field.
    ///
    /// You can use common icon names here, usually those in `/usr/share/icons`
    /// can all be used.
    /// You can also use an absolute path to file.
    ///
    /// # Platform support
    /// macOS does not have support manually setting the icon. However you can pretend to be another app using [`set_application()`](fn.set_application.html)
    pub fn icon(&mut self, icon: &str) -> &mut Notification {
        icon.clone_into(&mut self.icon);
        self
    }

    /// Set the `icon` field automatically.
    ///
    /// This looks at your binary's name and uses it to set the icon.
    ///
    /// # Platform support
    /// macOS does not support manually setting the icon. However you can pretend to be another app using [`set_application()`](fn.set_application.html)
    pub fn auto_icon(&mut self) -> &mut Notification {
        self.icon = exe_name();
        self
    }

    /// Adds a hint.
    ///
    /// This method will add a hint to the internal hint [`HashSet`].
    /// Hints must be of type [`Hint`].
    ///
    /// Many of these are wrapped by more convenient functions such as:
    ///
    /// * [`sound_name()`](Self::sound_name)
    /// * [`urgency()`](Self::urgency)
    /// * [`image(...)`](#method.image) or
    ///   * [`image_data(...)`](#method.image_data)
    ///   * [`image_path(...)`](#method.image_path)
    ///
    /// ```no_run
    /// # use notify_rust::Notification;
    /// # use notify_rust::Hint;
    /// Notification::new().summary("Category:email")
    ///                    .body("This should not go away until you acknowledge it.")
    ///                    .icon("thunderbird")
    ///                    .appname("thunderbird")
    ///                    .hint(Hint::Category("email".to_owned()))
    ///                    .hint(Hint::Resident(true))
    ///                    .show();
    /// ```
    ///
    /// # Platform support
    /// Most of these hints don't even have an effect on the big XDG Desktops, they are completely tossed on macOS.
    #[cfg(all(unix, not(target_os = "macos")))]
    pub fn hint(&mut self, hint: Hint) -> &mut Notification {
        match hint {
            Hint::CustomInt(k, v) => {
                self.hints_unique
                    .insert((k.clone(), CustomHintType::Int), Hint::CustomInt(k, v));
            }
            Hint::Custom(k, v) => {
                self.hints_unique
                    .insert((k.clone(), CustomHintType::String), Hint::Custom(k, v));
            }
            _ => {
                self.hints.insert(hint);
            }
        }
        self
    }

    #[cfg(all(unix, not(target_os = "macos")))]
    pub(crate) fn get_hints(&self) -> impl Iterator<Item = &Hint> {
        self.hints.iter().chain(self.hints_unique.values())
    }

    /// Set the `timeout`.
    ///
    /// Accepts multiple types that implement `Into<Timeout>`.
    ///
    /// ## `i32`
    ///
    /// This sets the time (in milliseconds) from the time the notification is displayed until it is
    /// closed again by the notification server.
    /// According to [specification](https://developer.gnome.org/notification-spec/)
    /// -1 will leave the timeout to be set by the server and
    /// 0 will cause the notification never to expire.
    /// ## [Duration](`std::time::Duration`)
    ///
    /// When passing a [`Duration`](`std::time::Duration`) we will try convert it into milliseconds.
    ///
    ///
    /// ```
    /// # use std::time::Duration;
    /// # use notify_rust::Timeout;
    /// assert_eq!(Timeout::from(Duration::from_millis(2000)), Timeout::Milliseconds(2000));
    /// ```
    /// ### Caveats!
    ///
    /// 1. If the duration is zero milliseconds then the original behavior will apply and the notification will **Never** timeout.
    /// 2. Should the number of milliseconds not fit within an [`i32`] then we will fall back to the default timeout.
    /// ```
    /// # use std::time::Duration;
    /// # use notify_rust::Timeout;
    /// assert_eq!(Timeout::from(Duration::from_millis(0)), Timeout::Never);
    /// assert_eq!(Timeout::from(Duration::from_millis(u64::MAX)), Timeout::Default);
    /// ```
    ///
    /// # Platform support
    /// This only works on XDG Desktops, macOS does not support manually setting the timeout.
    ///
    /// TODO: this will become available in 5.0 using `mac-usernotifications` using the new `.response()` api
    pub fn timeout<T: Into<Timeout>>(&mut self, timeout: T) -> &mut Notification {
        self.timeout = timeout.into();
        self
    }

    /// Set the `urgency`.
    ///
    /// Pick between Low, Normal, and Critical.
    ///
    /// # Platform support
    ///
    /// ## Linux/BSD (XDG)
    /// Urgency is sent as a hint to the notification server. Most desktops are fairly relaxed
    /// about urgency and may not change behavior significantly. Critical notifications are
    /// intended to not timeout automatically.
    ///
    /// ## Windows
    /// Urgency is mapped to toast scenarios:
    /// - `Low` and `Normal` → Default scenario (standard toast behavior)
    /// - `Critical` → Reminder scenario (stays on screen until user dismisses)
    ///
    /// ## macOS
    /// Mapped to [`InterruptionLevel`](`mac_usernotifications::InterruptionLevel`): `Low` → `Passive`, `Normal` → `Active`,
    /// `Critical` → `TimeSensitive`. Use `interruption_level`
    /// directly for finer control (e.g. `Critical` level that bypasses mute).
    #[cfg(all(unix, not(target_os = "macos")))]
    pub fn urgency(&mut self, urgency: Urgency) -> &mut Notification {
        self.hint(Hint::Urgency(urgency)); // TODO impl as T where T: Into<Urgency>
        self
    }

    /// Set the `urgency`.
    ///
    /// Pick between Low, Normal, and Critical.
    ///
    /// # Platform support
    ///
    /// ## Windows
    /// Urgency is mapped to toast scenarios:
    /// - `Low` and `Normal` → Default scenario (standard toast behavior)
    /// - `Critical` → Reminder scenario (stays on screen until user dismisses)
    ///
    /// ## Linux/BSD (XDG)
    /// See the Unix implementation documentation.
    ///
    /// ## macOS
    /// Mapped to [`InterruptionLevel`]: `Low` → `Passive`, `Normal` → `Active`,
    /// `Critical` → `TimeSensitive`. Use [`interruption_level`](Self::interruption_level)
    /// directly for finer control (e.g. `Critical` level that bypasses mute).
    #[cfg(target_os = "windows")]
    pub fn urgency(&mut self, urgency: Urgency) -> &mut Notification {
        self.urgency = Some(urgency);
        self
    }

    /// Set the `urgency` (macOS).
    ///
    /// Maps `Urgency` to the platform-native [`InterruptionLevel`]:
    /// - `Low` → [`Passive`](InterruptionLevel::Passive)
    /// - `Normal` → [`Active`](InterruptionLevel::Active)
    /// - `Critical` → [`TimeSensitive`](InterruptionLevel::TimeSensitive)
    ///
    /// For finer control (e.g. the `Critical` interruption level that bypasses
    /// mute and Do Not Disturb) use [`interruption_level`](Self::interruption_level)
    /// directly.
    #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
    pub fn urgency(&mut self, urgency: impl Into<InterruptionLevel>) -> &mut Notification {
        self.interruption_level.replace(urgency.into());
        self
    }

    /// Set `actions`.
    ///
    /// To quote <http://www.galago-project.org/specs/notification/0.9/x408.html#command-notify>
    ///
    /// >  Actions are sent over as a list of pairs.
    /// >  Each even element in the list (starting at index 0) represents the identifier for the action.
    /// >  Each odd element in the list is the localized string that will be displayed to the user.y
    ///
    /// There is nothing fancy going on here yet.
    /// **Careful! This replaces the internal list of actions!**
    #[deprecated(note = "please use .action() only")]
    pub fn actions(&mut self, actions: Vec<String>) -> &mut Notification {
        self.actions = actions;
        self
    }

    /// Add an action.
    ///
    /// This adds a single action to the internal list of actions.
    pub fn action(&mut self, identifier: &str, label: &str) -> &mut Notification {
        self.actions.push(identifier.to_owned());
        self.actions.push(label.to_owned());
        self
    }

    /// Set an id ahead of time.
    ///
    /// Setting the id ahead of time allows overriding a known other notification.
    /// If you want to update a notification, it is easier to use the `update()` method of
    /// the `NotificationHandle` object that `show()` returns.
    ///
    /// (XDG, Windows, and legacy macOS)
    #[cfg(not(all(target_os = "macos", feature = "preview-macos-un")))]
    pub fn id(&mut self, id: u32) -> &mut Notification {
        self.id = Some(id);
        self
    }

    /// Set a notification identifier (macOS `preview-macos-un` path).
    ///
    /// Re-posting with the same identifier replaces the existing notification.
    #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
    pub fn id(
        &mut self,
        id: impl Into<crate::notification_id::NotificationId>,
    ) -> &mut Notification {
        self.id = Some(id.into());
        self
    }

    /// Finalizes a notification.
    ///
    /// Part of the builder pattern, returns a complete copy of the built notification.
    pub fn finalize(&self) -> Notification {
        self.clone()
    }

    /// Schedules a notification to be sent at the specified date.
    #[cfg(all(target_os = "macos", feature = "chrono"))]
    pub fn schedule<T: chrono::TimeZone>(
        &self,
        delivery_date: chrono::DateTime<T>,
    ) -> Result<macos::NotificationHandle> {
        macos::schedule_notification(self, delivery_date.timestamp() as f64)
    }

    /// Schedules a notification to be sent at the specified timestamp.
    ///
    /// This is a raw `f64`. If you prefer a typed date, activate the `"chrono"` feature
    /// and use [`Notification::schedule()`] instead, which accepts a `chrono::DateTime<T>`.
    #[cfg(target_os = "macos")]
    pub fn schedule_raw(&self, timestamp: f64) -> Result<macos::NotificationHandle> {
        macos::schedule_notification(self, timestamp)
    }

    /// Sends the notification to D-Bus.
    ///
    /// Returns a handle to the notification.
    #[cfg(all(unix, not(target_os = "macos")))]
    pub fn show(&self) -> Result<xdg::NotificationHandle> {
        xdg::show_notification(self)
    }

    /// Sends the notification to D-Bus asynchronously.
    ///
    /// Returns a handle to the notification.
    #[cfg(all(unix, not(target_os = "macos")))]
    #[cfg(feature = "zbus")]
    pub async fn show_async(&self) -> Result<xdg::NotificationHandle> {
        xdg::show_notification_async(self).await
    }

    /// Sends the notification to D-Bus at the given sub-bus path.
    ///
    /// Returns a handle to the notification.
    #[cfg(all(unix, not(target_os = "macos")))]
    #[cfg(feature = "zbus")]
    // #[cfg(test)]
    pub async fn show_async_at_bus(&self, sub_bus: &str) -> Result<xdg::NotificationHandle> {
        let bus = xdg::NotificationBus::custom(sub_bus).ok_or("invalid subpath")?;
        xdg::show_notification_async_at_bus(self, bus).await
    }

    /// Sends Notification to `NSUserNotificationCenter` (default) or
    /// `UNUserNotificationCenter` (with `preview-macos-un` feature).
    #[cfg(target_os = "macos")]
    pub fn show(&self) -> Result<macos::NotificationHandle> {
        macos::show_notification(self)
    }

    /// Sends notification asynchronously via `UNUserNotificationCenter`.
    ///
    /// Only available with the `preview-macos-un` feature.
    #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
    pub async fn show_async(&self) -> Result<macos::NotificationHandle> {
        macos::show_notification_async(self).await
    }

    /// Sends Notification as a toast notification.
    #[cfg(target_os = "windows")]
    pub fn show(&self) -> Result<windows::NotificationHandle> {
        windows::show_notification(self)
    }

    /// Wraps [`Notification::show()`] but prints the notification to stdout.
    #[cfg(all(unix, not(target_os = "macos")))]
    #[deprecated = "this was never meant to be public API"]
    pub fn show_debug(&mut self) -> Result<xdg::NotificationHandle> {
        println!(
            "Notification:\n{appname}: ({icon}) {summary:?} {body:?}\nhints: [{hints:?}]\n",
            appname = self.appname,
            summary = self.summary,
            body = self.body,
            hints = self.hints,
            icon = self.icon,
        );
        self.show()
    }
}

impl Default for Notification {
    #[cfg(all(unix, not(target_os = "macos")))]
    fn default() -> Notification {
        Notification {
            appname: exe_name(),
            summary: String::new(),
            subtitle: None,
            body: String::new(),
            icon: String::new(),
            hints: HashSet::new(),
            hints_unique: HashMap::new(),
            actions: Vec::new(),
            timeout: Timeout::Default,
            bus: Default::default(),
            id: None,
        }
    }

    #[cfg(target_os = "macos")]
    fn default() -> Notification {
        Notification {
            appname: exe_name(),
            summary: String::new(),
            subtitle: None,
            body: String::new(),
            icon: String::new(),
            actions: Vec::new(),
            timeout: Timeout::Default,
            sound_name: Default::default(),
            path_to_image: None,
            #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
            interruption_level: None,
            id: None,
        }
    }

    #[cfg(target_os = "windows")]
    fn default() -> Notification {
        Notification {
            appname: exe_name(),
            summary: String::new(),
            subtitle: None,
            body: String::new(),
            icon: String::new(),
            actions: Vec::new(),
            timeout: Timeout::Default,
            sound_name: Default::default(),
            id: None,
            path_to_image: None,
            app_id: None,
            urgency: None,
        }
    }
}