tony / oxwm

fixing underline width.. Browse files
tonybanters committed 2025-10-03 parent 7b4ea87 commit afc557872dadf7721400fffb1a9fc4e11c3cf429
Showing 1 changed file with 8 additions and 6 deletions. UnifiedSplit
+8 −6 src/bar/bar.rs
@@ -147,17 +147,18 @@ impl Bar {
147 147 let text_width = self.font.text_width(tag);
148 148 let text_x = x_position + ((tag_width - text_width) / 2) as i16;
149 149
150 - let text_height = self.font.height();
151 - let top_margin = (self.height as i16 - text_height as i16) / 4;
152 - let text_y = top_margin + self.font.ascent();
150 + let font_height = self.font.height();
151 + let top_padding = font_height / 3;
152 + let text_y = top_padding as i16 + self.font.ascent();
153 153
154 154 self.font_draw
155 155 .draw_text(&self.font, scheme.foreground, text_x, text_y, tag);
156 156
157 157 if is_selected {
158 - let underline_height = (self.font.height() / 8).max(2);
159 - let bottom_margin = 4;
160 - let underline_y = self.height as i16 - underline_height as i16 - bottom_margin;
158 + let underline_height = font_height / 6;
159 + let gap_between_text_and_underline = font_height / 4;
160 +
161 + let underline_y = text_y + gap_between_text_and_underline as i16;
161 162
162 163 let underline_padding = 4;
163 164 let underline_width = tag_width - underline_padding;
@@ -178,6 +179,7 @@ impl Bar {
178 179 }],
179 180 )?;
180 181 }
182 +
181 183 x_position += tag_width as i16;
182 184 }
183 185 connection.flush()?;