tony / oxwm

changed bar Browse files
tonybanters committed 2025-10-03 parent 08512bf commit 2a9afc3410193ea6f3f7c293a288b15b73f00ab7
Showing 2 changed files with 12 additions and 31 deletions. UnifiedSplit
+3 −22 src/bar/bar.rs
@@ -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
+9 −9 src/config.rs
@@ -8,7 +8,7 @@ use x11rb::protocol::xproto::KeyButMask;
8 pub const BORDER_WIDTH: u32 = 1; 8 pub const BORDER_WIDTH: u32 = 1;
9 pub const BORDER_FOCUSED: u32 = 0x6dade3; 9 pub const BORDER_FOCUSED: u32 = 0x6dade3;
10 pub const BORDER_UNFOCUSED: u32 = 0xbbbbbb; 10 pub const BORDER_UNFOCUSED: u32 = 0xbbbbbb;
11 -pub const BAR_HEIGHT: u16 = 30; 11 +pub const BAR_HEIGHT: u16 = 32;
12 pub const FONT: &str = "JetBrainsMono Nerd Font:size=16"; 12 pub const FONT: &str = "JetBrainsMono Nerd Font:size=16";
13 13
14 // ======================================== 14 // ========================================
@@ -25,7 +25,7 @@ pub const MODKEY: KeyButMask = KeyButMask::MOD1;
25 const GRAY_DARK: u32 = 0x222222; 25 const GRAY_DARK: u32 = 0x222222;
26 const GRAY_MID: u32 = 0x444444; 26 const GRAY_MID: u32 = 0x444444;
27 const GRAY_LIGHT: u32 = 0xbbbbbb; 27 const GRAY_LIGHT: u32 = 0xbbbbbb;
28 -const GRAY_LIGHTEST: u32 = 0xeeeeee; 28 +// const GRAY_LIGHTEST: u32 = 0xeeeeee;
29 const CYAN: u32 = 0x6dade3; 29 const CYAN: u32 = 0x6dade3;
30 30
31 pub struct ColorScheme { 31 pub struct ColorScheme {
@@ -40,14 +40,14 @@ pub const SCHEME_NORMAL: ColorScheme = ColorScheme {
40 border: GRAY_MID, 40 border: GRAY_MID,
41 }; 41 };
42 42
43 -pub const SCHEME_SELECTED: ColorScheme = ColorScheme { 43 +// pub const SCHEME_OCCUPIED: ColorScheme = ColorScheme {
44 - foreground: GRAY_LIGHTEST, 44 +// foreground: CYAN,
45 - background: CYAN, 45 +// background: GRAY_DARK,
46 - border: CYAN, 46 +// border: CYAN,
47 -}; 47 +// };
48 48
49 -pub const SCHEME_OCCUPIED: ColorScheme = ColorScheme { 49 +pub const SCHEME_SELECTED: ColorScheme = ColorScheme {
50 - foreground: GRAY_LIGHTEST, 50 + foreground: CYAN,
51 background: GRAY_DARK, 51 background: GRAY_DARK,
52 border: CYAN, 52 border: CYAN,
53 }; 53 };