tony / oxwm

fixing underline width.. Browse files
tonybanters committed 2025-10-03 parent afc5578 commit a87ffc03d63ecedba76f97234792fd1950974d90
Showing 1 changed file with 8 additions and 8 deletions. UnifiedSplit
+8 −8 src/bar/bar.rs
@@ -32,7 +32,8 @@ impl Bar {
32 anyhow::bail!("Failed to open X11 display for XFT"); 32 anyhow::bail!("Failed to open X11 display for XFT");
33 } 33 }
34 let font = Font::new(display, screen_num as i32, FONT)?; 34 let font = Font::new(display, screen_num as i32, FONT)?;
35 - let height = font.height() + 4; 35 +
36 + let height = (font.height() as f32 * 1.8) as u16;
36 37
37 connection.create_window( 38 connection.create_window(
38 COPY_DEPTH_FROM_PARENT, 39 COPY_DEPTH_FROM_PARENT,
@@ -147,18 +148,17 @@ impl Bar {
147 let text_width = self.font.text_width(tag); 148 let text_width = self.font.text_width(tag);
148 let text_x = x_position + ((tag_width - text_width) / 2) as i16; 149 let text_x = x_position + ((tag_width - text_width) / 2) as i16;
149 150
150 - let font_height = self.font.height(); 151 + let top_padding = 4;
151 - let top_padding = font_height / 3; 152 + let text_y = top_padding + self.font.ascent();
152 - let text_y = top_padding as i16 + self.font.ascent();
153 153
154 self.font_draw 154 self.font_draw
155 .draw_text(&self.font, scheme.foreground, text_x, text_y, tag); 155 .draw_text(&self.font, scheme.foreground, text_x, text_y, tag);
156 156
157 if is_selected { 157 if is_selected {
158 - let underline_height = font_height / 6; 158 + let font_height = self.font.height();
159 - let gap_between_text_and_underline = font_height / 4; 159 + let underline_height = font_height / 8;
160 - 160 + let bottom_gap = 3;
161 - let underline_y = text_y + gap_between_text_and_underline as i16; 161 + let underline_y = self.height as i16 - underline_height as i16 - bottom_gap;
162 162
163 let underline_padding = 4; 163 let underline_padding = 4;
164 let underline_width = tag_width - underline_padding; 164 let underline_width = tag_width - underline_padding;