oxwm

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

fixing underline width..

Commit
afc557872dadf7721400fffb1a9fc4e11c3cf429
Parent
7b4ea87
Author
tonybanters <tonybanters@gmail.com>
Date
2025-10-03 20:07:04

Diff

diff --git a/src/bar/bar.rs b/src/bar/bar.rs
index 452a2f7..a1b3484 100644
--- a/src/bar/bar.rs
+++ b/src/bar/bar.rs
@@ -147,17 +147,18 @@ impl Bar {
             let text_width = self.font.text_width(tag);
             let text_x = x_position + ((tag_width - text_width) / 2) as i16;
 
-            let text_height = self.font.height();
-            let top_margin = (self.height as i16 - text_height as i16) / 4;
-            let text_y = top_margin + self.font.ascent();
+            let font_height = self.font.height();
+            let top_padding = font_height / 3;
+            let text_y = top_padding as i16 + self.font.ascent();
 
             self.font_draw
                 .draw_text(&self.font, scheme.foreground, text_x, text_y, tag);
 
             if is_selected {
-                let underline_height = (self.font.height() / 8).max(2);
-                let bottom_margin = 4;
-                let underline_y = self.height as i16 - underline_height as i16 - bottom_margin;
+                let underline_height = font_height / 6;
+                let gap_between_text_and_underline = font_height / 4;
+
+                let underline_y = text_y + gap_between_text_and_underline as i16;
 
                 let underline_padding = 4;
                 let underline_width = tag_width - underline_padding;
@@ -178,6 +179,7 @@ impl Bar {
                     }],
                 )?;
             }
+
             x_position += tag_width as i16;
         }
         connection.flush()?;