feat: add ecc2 completion summary notifications

This commit is contained in:
Affaan Mustafa
2026-04-09 20:59:24 -07:00
parent a4d0a4fc14
commit b45a6ca810
7 changed files with 828 additions and 70 deletions

View File

@@ -32,6 +32,22 @@ pub struct DesktopNotificationConfig {
pub quiet_hours: QuietHoursConfig,
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum CompletionSummaryDelivery {
#[default]
Desktop,
TuiPopup,
DesktopAndTuiPopup,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(default)]
pub struct CompletionSummaryConfig {
pub enabled: bool,
pub delivery: CompletionSummaryDelivery,
}
#[derive(Debug, Clone)]
pub struct DesktopNotifier {
config: DesktopNotificationConfig,
@@ -112,6 +128,33 @@ impl DesktopNotificationConfig {
}
}
impl Default for CompletionSummaryConfig {
fn default() -> Self {
Self {
enabled: true,
delivery: CompletionSummaryDelivery::Desktop,
}
}
}
impl CompletionSummaryConfig {
pub fn desktop_enabled(&self) -> bool {
self.enabled
&& matches!(
self.delivery,
CompletionSummaryDelivery::Desktop | CompletionSummaryDelivery::DesktopAndTuiPopup
)
}
pub fn popup_enabled(&self) -> bool {
self.enabled
&& matches!(
self.delivery,
CompletionSummaryDelivery::TuiPopup | CompletionSummaryDelivery::DesktopAndTuiPopup
)
}
}
impl DesktopNotifier {
pub fn new(config: DesktopNotificationConfig) -> Self {
Self {