tony / oxwm

fixing underline width.. Browse files
tonybanters committed 2025-10-03 parent 9c46346 commit c847ca585c6129c95ef985be109abf2bb047c070
Showing 1 changed file with 5 additions and 7 deletions. UnifiedSplit
+5 −7 src/bar/bar.rs
@@ -67,7 +67,7 @@ impl Bar {
67 67
68 68 let font_draw = FontDraw::new(display, window as x11::xlib::Drawable, visual, colormap)?;
69 69
70 - let horizontal_padding = (font.height() as f32 * 0.6) as u16;
70 + let horizontal_padding = (font.height() as f32 * 0.4) as u16;
71 71
72 72 let tag_widths = TAGS
73 73 .iter()
@@ -144,7 +144,6 @@ impl Bar {
144 144 &SCHEME_NORMAL
145 145 };
146 146
147 - // Center text horizontally in tag box
148 147 let text_width = self.font.text_width(tag);
149 148 let text_x = x_position + ((tag_width - text_width) / 2) as i16;
150 149
@@ -156,13 +155,12 @@ impl Bar {
156 155 .draw_text(&self.font, scheme.foreground, text_x, text_y, tag);
157 156
158 157 if is_selected {
159 - // Scale underline thickness with font size (roughly 1/8 of font height)
160 - let underline_height = (self.font.height() / 8).max(2) as u16;
158 + let underline_height = (self.font.height() / 8).max(2);
161 159 let bottom_margin = 4;
162 160 let underline_y = self.height as i16 - underline_height as i16 - bottom_margin;
163 161
164 - // Make underline same width and position as text
165 - let underline_x = text_x;
162 + let underline_width = text_width + 6;
163 + let underline_x = text_x - 3;
166 164
167 165 connection.change_gc(
168 166 self.graphics_context,
@@ -174,7 +172,7 @@ impl Bar {
174 172 &[Rectangle {
175 173 x: underline_x,
176 174 y: underline_y,
177 - width: text_width,
175 + width: underline_width,
178 176 height: underline_height,
179 177 }],
180 178 )?;