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
//! Bell notification settings — visual, audio, and desktop bell.
use crate::SettingsUI;
use crate::search::SearchTag;
use crate::section::{SLIDER_WIDTH, keyword_section};
use std::collections::HashSet;
const SLIDER_HEIGHT: f32 = 18.0;
pub(crate) fn show_bell_section(
ui: &mut egui::Ui,
settings: &mut SettingsUI,
changes_this_frame: &mut bool,
collapsed: &mut HashSet<String>,
) {
keyword_section(
ui,
"Bell",
"notifications_bell",
&["sound", "beep", "flash colour"],
true,
collapsed,
|ui| {
if ui
.checkbox(
&mut settings.config.notifications.notification_bell_visual,
"Visual bell",
)
.search_tag(&["notification_bell_visual"])
.changed()
{
settings.has_changes = true;
*changes_this_frame = true;
}
crate::dependent::dependent(
ui,
settings.config.notifications.notification_bell_visual,
"Visual bell",
|ui| {
ui.horizontal(|ui| {
ui.label("Flash color:");
if crate::color_helpers::rgb_color_button(
ui,
&mut settings.config.notifications.notification_visual_bell_color,
)
.search_tag(&["notification_visual_bell_color"])
.changed()
{
settings.has_changes = true;
*changes_this_frame = true;
}
});
},
);
// One bell model (UX.md B40): an enabled Alert Sounds › Bell entry
// owns the bell's sound, so the plain volume is disabled rather than
// silently ignored.
let alert_owns_bell = settings
.config
.notifications
.alert_sounds
.get(&par_term_config::AlertEvent::Bell)
.is_some_and(|alert| alert.enabled);
crate::dependent::dependent(ui, !alert_owns_bell, "Alert Sounds › Bell: off", |ui| {
ui.horizontal(|ui| {
ui.label("Audio bell volume:");
if ui
.add_sized(
[SLIDER_WIDTH, SLIDER_HEIGHT],
egui::Slider::new(
&mut settings.config.notifications.notification_bell_sound,
0..=100,
)
.suffix(" %"),
)
.search_tag(&["notification_bell_sound"])
.on_hover_text("0 % turns the audio bell off")
.changed()
{
settings.has_changes = true;
*changes_this_frame = true;
}
crate::reset::reset_button(ui, settings, changes_this_frame, |c| {
&mut c.notifications.notification_bell_sound
});
});
});
if alert_owns_bell {
ui.label(
egui::RichText::new(
"The Bell entry under Alert Sounds sets the bell's sound and volume.",
)
.small()
.color(egui::Color32::GRAY),
);
}
if ui
.checkbox(
&mut settings.config.notifications.notification_bell_desktop,
"Desktop notifications for bell",
)
.search_tag(&["notification_bell_desktop"])
.changed()
{
settings.has_changes = true;
*changes_this_frame = true;
}
},
);
}