1#[cfg(linux_pc)]
2mod linux_tray;
3#[cfg(any(target_os = "windows", target_os = "macos"))]
4mod generic_tray;
5
6#[cfg(not(any(linux_pc, target_os = "windows", target_os = "macos")))]
7mod no_tray;
8
9use serde::{Deserialize, Serialize};
10#[cfg(linux_pc)]
11pub use crate::linux_tray::LinuxTray as Tray;
12#[cfg(any(target_os = "windows", target_os = "macos"))]
13pub use crate::generic_tray::GenericTray as Tray;
14#[cfg(not(any(linux_pc, target_os = "windows", target_os = "macos")))]
15pub use crate::no_tray::NoTray as Tray;
16
17
18#[derive(Debug, Serialize, Deserialize)]
19#[serde(rename_all = "camelCase")]
20pub struct TrayMenu {
21 pub id: Option<String>,
22 pub label: Option<String>,
23 pub kind: String,
24 pub checked: Option<bool>,
25 pub enabled: Option<bool>,
26}
27pub enum MenuKind {
28 Standard,
29 Checkmark,
30 Separator,
31}
32
33impl MenuKind {
34 pub fn from_str(str: &str) -> Option<MenuKind> {
35 match str {
36 "standard" => Some(MenuKind::Standard),
37 "checkmark" => Some(MenuKind::Checkmark),
38 "separator" => Some(MenuKind::Separator),
39 _ => None,
40 }
41 }
42}