about summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-11-25 03:40:14 -0700
committerIrene Knapp <ireneista@irenes.space>2026-11-25 04:16:31 -0700
commitb65303ede0750e9d83df4d2c5df67f143c9171c4 (patch)
treea8d15bdaa3493ed7a8b66092e6f58cf6ebe1909f /src/main.rs
parent5ec7ae026ce9d8c48ef5f0590a300fa308efa487 (diff)
i3 mode module fully works now; some API changes
most notably, modules now have a way to request immediate redrawing

Change-Id: Id060c88d3ab484addfd8ca574fbc4e2ffdbb5c8f
Force-Push: yes
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index a2baf8f..225ca2c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -117,9 +117,13 @@ fn main() -> ExitCode {
 async fn async_main(_shutdown_sender: Sender<()>) -> Result<()> {
   let display = Arc::new(Display::new()?);
   let configuration = DockConfiguration::new(&display)?;
-  let dock = Dock::new(Arc::clone(&display), configuration).await?;
 
   let (redraw_sender, redraw_receiver) = async_channel::unbounded();
+
+  let dock = Dock::new(Arc::clone(&display),
+                       configuration,
+                       Sender::clone(&redraw_sender)).await?;
+
   let event_task = EXECUTOR.spawn(
           event_loop(display, Arc::clone(&dock),
                      Sender::clone(&redraw_sender)));
@@ -162,7 +166,9 @@ impl DockConfiguration {
 
 
 impl Dock {
-  async fn new(display: Arc<Display>, configuration: DockConfiguration)
+  async fn new(display: Arc<Display>,
+               configuration: DockConfiguration,
+               redraw_sender: Sender<()>)
     -> Result<Arc<Mutex<Dock>>>
   {
     let screen = display.screen();
@@ -218,7 +224,8 @@ impl Dock {
 
       modules.push((Arc::new(Mutex::new(TimeModule::new(
                         facilities.borrow_mut(),
-                        &EXECUTOR).await?.as_box())),
+                        &EXECUTOR,
+                        Sender::clone(&redraw_sender)).await?.as_box())),
                     ModuleFraming
       {
         alignment: Alignment::Right,
@@ -226,7 +233,8 @@ impl Dock {
 
       modules.push((Arc::new(Mutex::new(BatteryModule::new(
                         facilities.borrow_mut(),
-                        &EXECUTOR).await?.as_box())),
+                        &EXECUTOR,
+                        Sender::clone(&redraw_sender)).await?.as_box())),
                     ModuleFraming
       {
         alignment: Alignment::Right,
@@ -234,7 +242,8 @@ impl Dock {
 
       modules.push((Arc::new(Mutex::new(I3ModeModule::new(
                         facilities.borrow_mut(),
-                        &EXECUTOR).await?.as_box())),
+                        &EXECUTOR,
+                        Sender::clone(&redraw_sender)).await?.as_box())),
                     ModuleFraming
       {
         alignment: Alignment::Left,