oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git

drop `Result` from `bar::update_blocks` and convert `bar::draw` to use the `X11Error` type

Commit
34487bf67f3b006968a5b464134bca4d1fb6ffbc
Parent
ed85f11
Author
emzywastaken <amiamemetoo@gmail.com>
Date
2025-10-14 11:11:14
update_blocks no longer returns a Result since it can't fail

Diff

diff --git a/src/bar/bar.rs b/src/bar/bar.rs
index 86f97e7..23d6af5 100644
--- a/src/bar/bar.rs
+++ b/src/bar/bar.rs
@@ -1,6 +1,7 @@
 use super::blocks::Block;
 use super::font::{Font, FontDraw};
 use crate::Config;
+use crate::window_manager::X11Error;
 use anyhow::Result;
 use std::time::Instant;
 use x11rb::COPY_DEPTH_FROM_PARENT;
@@ -148,7 +149,7 @@ impl Bar {
         self.needs_redraw = true;
     }
 
-    pub fn update_blocks(&mut self) -> Result<()> {
+    pub fn update_blocks(&mut self) {
         let now = Instant::now();
         let mut changed = false;
 
@@ -173,8 +174,6 @@ impl Bar {
             self.status_text = parts.join("");
             self.needs_redraw = true;
         }
-
-        Ok(())
     }
 
     pub fn draw(
@@ -182,7 +181,7 @@ impl Bar {
         connection: &RustConnection,
         current_tags: u32,
         occupied_tags: u32,
-    ) -> Result<()> {
+    ) -> std::result::Result<(), X11Error> {
         if !self.needs_redraw {
             return Ok(());
         }
diff --git a/src/window_manager.rs b/src/window_manager.rs
index f3eeb75..9d809f3 100644
--- a/src/window_manager.rs
+++ b/src/window_manager.rs
@@ -378,8 +378,7 @@ impl WindowManager {
         self.update_bar()?;
 
         loop {
-            // TODO: Identify errors
-            self.bar.update_blocks()?;
+            self.bar.update_blocks();
 
             if let Ok(Some(event)) = self.connection.poll_for_event() {
                 if let Some(should_restart) = self.handle_event(event)? {
@@ -436,7 +435,6 @@ impl WindowManager {
         }
 
         self.bar.invalidate();
-        // TODO: Identify errors
         self.bar
             .draw(&self.connection, self.selected_tags, occupied_tags)?;
         Ok(())