Skip to main content

tauri_plugin_taskbar/
models.rs

1use serde::Deserialize;
2
3#[derive(Debug, Clone, Deserialize)]
4#[serde(default, rename_all = "camelCase")]
5pub struct Config {
6    pub auto_attach: bool,
7    pub window_label: String,
8    pub icons: IconPaths,
9    pub events: EventNames,
10    pub tooltips: Tooltips,
11}
12
13impl Default for Config {
14    fn default() -> Self {
15        Self {
16            auto_attach: true,
17            window_label: "main".to_string(),
18            icons: IconPaths::default(),
19            events: EventNames::default(),
20            tooltips: Tooltips::default(),
21        }
22    }
23}
24
25#[derive(Debug, Clone, Deserialize)]
26#[serde(default, rename_all = "camelCase")]
27pub struct IconPaths {
28    pub previous: String,
29    pub previous_disabled: String,
30    pub play: String,
31    pub pause: String,
32    pub next: String,
33    pub next_disabled: String,
34}
35
36impl Default for IconPaths {
37    fn default() -> Self {
38        Self {
39            previous: "icons/taskbar/PREV_THUMB.ico".to_string(),
40            previous_disabled: "icons/taskbar/PREV_THUMB_DISABLED.ico".to_string(),
41            play: "icons/taskbar/PLAY_THUMB.ico".to_string(),
42            pause: "icons/taskbar/PAUSE_THUMB.ico".to_string(),
43            next: "icons/taskbar/NEXT_THUMB.ico".to_string(),
44            next_disabled: "icons/taskbar/NEXT_THUMB_DISABLED.ico".to_string(),
45        }
46    }
47}
48
49#[derive(Debug, Clone, Deserialize)]
50#[serde(default, rename_all = "camelCase")]
51pub struct EventNames {
52    pub previous: String,
53    pub toggle: String,
54    pub next: String,
55}
56
57impl Default for EventNames {
58    fn default() -> Self {
59        Self {
60            previous: "media-prev".to_string(),
61            toggle: "media-toggle".to_string(),
62            next: "media-next".to_string(),
63        }
64    }
65}
66
67#[derive(Debug, Clone, Deserialize)]
68#[serde(default, rename_all = "camelCase")]
69pub struct Tooltips {
70    pub previous: String,
71    pub play: String,
72    pub pause: String,
73    pub next: String,
74}
75
76impl Default for Tooltips {
77    fn default() -> Self {
78        Self {
79            previous: "Previous".to_string(),
80            play: "Play".to_string(),
81            pause: "Pause".to_string(),
82            next: "Next".to_string(),
83        }
84    }
85}