about summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 76e7fbb..d7710c7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -345,7 +345,22 @@ impl Dock {
       let mut facilities = self.facilities.lock()?;
 
       for (module, framing) in &self.modules {
-        let text = module.lock()?.format(facilities.borrow_mut())?;
+        let text = {
+          let mut module = module.lock()?;
+
+          let text = module.format(facilities.borrow_mut())?;
+
+          /*   We do this after calling format(), rather than before, to give
+           * the module a chance to decide whether it's shy. Thus, for example,
+           * hot-plugging the only battery will make the Battery module appear
+           * or disappear on the very next redraw, which will likely exceed the
+           * user's expectation of slickness.
+           */
+          if !module.is_visible() { continue; }
+
+          text
+        };
+
         self.draw_text(&mut open_parcel, &text, framing.alignment)?;
       }
     }