updating padding
Browse files
+4 −4 src/bar/bar.rs
| @@ -161,8 +161,9 @@ impl Bar { | ||
| 161 | 161 | let bottom_margin = 4; |
| 162 | 162 | let underline_y = self.height as i16 - underline_height as i16 - bottom_margin; |
| 163 | 163 | |
| 164 | - let underline_padding = 4; | |
| 165 | - let underline_width = tag_width - underline_padding; | |
| 164 | + let text_width = self.font.text_width(tag); | |
| 165 | + let underline_width = text_width + 4; | |
| 166 | + let underline_x = x_position + ((tag_width - underline_width) / 2) as i16; | |
| 166 | 167 | |
| 167 | 168 | connection.change_gc( |
| 168 | 169 | self.graphics_context, |
| @@ -172,14 +173,13 @@ impl Bar { | ||
| 172 | 173 | self.window, |
| 173 | 174 | self.graphics_context, |
| 174 | 175 | &[Rectangle { |
| 175 | - x: x_position + (underline_padding / 2) as i16, | |
| 176 | + x: underline_x, | |
| 176 | 177 | y: underline_y, |
| 177 | 178 | width: underline_width, |
| 178 | 179 | height: underline_height, |
| 179 | 180 | }], |
| 180 | 181 | )?; |
| 181 | 182 | } |
| 182 | - | |
| 183 | 183 | x_position += tag_width as i16; |
| 184 | 184 | } |
| 185 | 185 | connection.flush()?; |