| @@ -1,5 +1,5 @@ |
| 1 |
use super::font::{Font, FontDraw}; |
1 |
use super::font::{Font, FontDraw}; |
| 2 |
-use crate::config::{BAR_HEIGHT, FONT, SCHEME_NORMAL, SCHEME_OCCUPIED, SCHEME_SELECTED, TAGS}; |
2 |
+use crate::config::{BAR_HEIGHT, FONT, SCHEME_NORMAL, SCHEME_SELECTED, TAGS}; |
| 3 |
use anyhow::Result; |
3 |
use anyhow::Result; |
| 4 |
use x11rb::COPY_DEPTH_FROM_PARENT; |
4 |
use x11rb::COPY_DEPTH_FROM_PARENT; |
| 5 |
use x11rb::connection::Connection; |
5 |
use x11rb::connection::Connection; |
| @@ -104,6 +104,7 @@ impl Bar { |
| 104 |
if !self.needs_redraw { |
104 |
if !self.needs_redraw { |
| 105 |
return Ok(()); |
105 |
return Ok(()); |
| 106 |
} |
106 |
} |
|
|
107 |
+ |
| 107 |
connection.change_gc( |
108 |
connection.change_gc( |
| 108 |
self.graphics_context, |
109 |
self.graphics_context, |
| 109 |
&ChangeGCAux::new().foreground(SCHEME_NORMAL.background), |
110 |
&ChangeGCAux::new().foreground(SCHEME_NORMAL.background), |
| @@ -128,31 +129,12 @@ impl Bar { |
| 128 |
|
129 |
|
| 129 |
let tag_width = self.tag_widths[tag_index]; |
130 |
let tag_width = self.tag_widths[tag_index]; |
| 130 |
|
131 |
|
| 131 |
- let scheme = if is_selected { |
132 |
+ let scheme = if is_selected || is_occupied { |
| 132 |
&SCHEME_SELECTED |
133 |
&SCHEME_SELECTED |
| 133 |
- } else if is_occupied { |
|
|
| 134 |
- &SCHEME_OCCUPIED |
|
|
| 135 |
} else { |
134 |
} else { |
| 136 |
&SCHEME_NORMAL |
135 |
&SCHEME_NORMAL |
| 137 |
}; |
136 |
}; |
| 138 |
|
137 |
|
| 139 |
- if is_selected { |
|
|
| 140 |
- connection.change_gc( |
|
|
| 141 |
- self.graphics_context, |
|
|
| 142 |
- &ChangeGCAux::new().foreground(scheme.background), |
|
|
| 143 |
- )?; |
|
|
| 144 |
- connection.poly_fill_rectangle( |
|
|
| 145 |
- self.window, |
|
|
| 146 |
- self.graphics_context, |
|
|
| 147 |
- &[Rectangle { |
|
|
| 148 |
- x: x_position, |
|
|
| 149 |
- y: 0, |
|
|
| 150 |
- width: tag_width, |
|
|
| 151 |
- height: self.height, |
|
|
| 152 |
- }], |
|
|
| 153 |
- )?; |
|
|
| 154 |
- } |
|
|
| 155 |
- |
|
|
| 156 |
let text_y = (self.height as i16 / 2) + (self.font.ascent() / 2); |
138 |
let text_y = (self.height as i16 / 2) + (self.font.ascent() / 2); |
| 157 |
self.font_draw |
139 |
self.font_draw |
| 158 |
.draw_text(&self.font, scheme.foreground, x_position + 5, text_y, tag); |
140 |
.draw_text(&self.font, scheme.foreground, x_position + 5, text_y, tag); |
| @@ -174,7 +156,6 @@ impl Bar { |
| 174 |
}], |
156 |
}], |
| 175 |
)?; |
157 |
)?; |
| 176 |
} |
158 |
} |
| 177 |
- |
|
|
| 178 |
x_position += tag_width as i16; |
159 |
x_position += tag_width as i16; |
| 179 |
} |
160 |
} |
| 180 |
|
161 |
|