asked the clanker to change the arcidecture a bit

This commit is contained in:
2026-09-09 15:50:07 +01:00
parent 3490af52e4
commit b9c7e73824
15 changed files with 185 additions and 74 deletions
+1
View File
@@ -9,3 +9,4 @@ path = "src/lib.rs"
[dependencies]
iced = { workspace = true }
toml = { workspace = true }
+16 -4
View File
@@ -1,15 +1,16 @@
//! Barbar's protocol crate: the types that cross crate boundaries.
//!
//! Nothing here may reference app-level types (`Message`, `Cmd`, `Msg`,
//! Nothing here may reference app-level types (`Message`, `Msg`,
//! layer-shell effects). `common` is the hub every other crate depends on,
//! so it must stay acyclic and pure.
use std::any::Any;
use std::error::Error;
use std::fmt;
use std::sync::Arc;
use iced::window;
use iced::{Element, Task};
use iced::{Element, Rectangle, Task};
// ---------------------------------------------------------------------------
// Service model
@@ -95,12 +96,16 @@ impl fmt::Debug for ModuleMsg {
}
}
/// What a module asks the app to do. Modules never name app types; the app
/// maps these into its own effects (`Cmd`).
/// What a module asks the app to do — the single effect vocabulary shared by
/// modules and app, so mapping module output into a `Message` is a plain
/// `.map(Message::Effect)` with no mirror enum.
#[derive(Debug, Clone)]
pub enum ModuleEffect {
/// Toggle a popup for the given module id (element id anchors it).
RequestPopup(String, String),
/// A widget-tree pass reported a module's laid-out bounds; anchor the
/// popup there. App-internal, but one effect type keeps routing trivial.
BoundsFound(String, Rectangle),
/// Request removal of the popup surface.
ClosePopup(window::Id),
}
@@ -124,4 +129,11 @@ pub trait BarModule: Send {
fn popup_size(&self) -> Option<(u32, u32)> {
None
}
/// Digest config from `module.{module-id}`. Error is boxed because this
/// runs through `dyn BarModule`; each impl keeps its own concrete error
/// internally and may surface it pre-box via its constructor instead.
fn config(&mut self, _config: toml::Table) -> Result<(), Box<dyn Error>> {
Ok(())
}
}