par_term_config/config/config_struct/
notification_config.rs1use crate::types::{AlertEvent, AlertSoundConfig};
11use serde::{Deserialize, Serialize};
12use std::collections::HashMap;
13
14#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct NotificationConfig {
21 #[serde(default = "crate::defaults::bool_false", alias = "bell_desktop")]
23 pub notification_bell_desktop: bool,
24
25 #[serde(default = "crate::defaults::bell_sound", alias = "bell_sound")]
27 pub notification_bell_sound: u8,
28
29 #[serde(default = "crate::defaults::bool_true", alias = "bell_visual")]
31 pub notification_bell_visual: bool,
32
33 #[serde(default = "crate::defaults::visual_bell_color")]
35 pub notification_visual_bell_color: [u8; 3],
36
37 #[serde(
39 default = "crate::defaults::bool_false",
40 alias = "activity_notifications"
41 )]
42 pub notification_activity_enabled: bool,
43
44 #[serde(
46 default = "crate::defaults::activity_threshold",
47 alias = "activity_threshold"
48 )]
49 pub notification_activity_threshold: u64,
50
51 #[serde(default = "crate::defaults::bool_false")]
53 pub anti_idle_enabled: bool,
54
55 #[serde(default = "crate::defaults::anti_idle_seconds")]
57 pub anti_idle_seconds: u64,
58
59 #[serde(default = "crate::defaults::anti_idle_code")]
61 pub anti_idle_code: u8,
62
63 #[serde(
65 default = "crate::defaults::bool_false",
66 alias = "silence_notifications"
67 )]
68 pub notification_silence_enabled: bool,
69
70 #[serde(
72 default = "crate::defaults::silence_threshold",
73 alias = "silence_threshold"
74 )]
75 pub notification_silence_threshold: u64,
76
77 #[serde(default = "crate::defaults::bool_false", alias = "session_ended")]
79 pub notification_session_ended: bool,
80
81 #[serde(default = "crate::defaults::bool_true")]
83 pub suppress_notifications_when_focused: bool,
84
85 #[serde(
87 default = "crate::defaults::notification_max_buffer",
88 alias = "max_notifications"
89 )]
90 pub notification_max_buffer: usize,
91
92 #[serde(default)]
96 pub alert_sounds: HashMap<AlertEvent, AlertSoundConfig>,
97}
98
99impl Default for NotificationConfig {
100 fn default() -> Self {
101 Self {
102 notification_bell_desktop: crate::defaults::bool_false(),
103 notification_bell_sound: crate::defaults::bell_sound(),
104 notification_bell_visual: crate::defaults::bool_true(),
105 notification_visual_bell_color: crate::defaults::visual_bell_color(),
106 notification_activity_enabled: crate::defaults::bool_false(),
107 notification_activity_threshold: crate::defaults::activity_threshold(),
108 anti_idle_enabled: crate::defaults::bool_false(),
109 anti_idle_seconds: crate::defaults::anti_idle_seconds(),
110 anti_idle_code: crate::defaults::anti_idle_code(),
111 notification_silence_enabled: crate::defaults::bool_false(),
112 notification_silence_threshold: crate::defaults::silence_threshold(),
113 notification_session_ended: crate::defaults::bool_false(),
114 suppress_notifications_when_focused: crate::defaults::bool_true(),
115 notification_max_buffer: crate::defaults::notification_max_buffer(),
116 alert_sounds: HashMap::new(),
117 }
118 }
119}