tony / oxwm

updating padding Browse files
tonybanters committed 2025-10-03 parent 6dfb18c commit 2a0c2b90ba2775c3ee444a783f69d4c7e2eebcf1
Showing 2 changed files with 9 additions and 3 deletions. UnifiedSplit
+9 −2 src/bar/bar.rs
@@ -1,5 +1,5 @@
1 1 use super::font::{Font, FontDraw};
2 -use crate::config::{BAR_HEIGHT, FONT, SCHEME_NORMAL, SCHEME_OCCUPIED, SCHEME_SELECTED, TAGS};
2 +use crate::config::{FONT, SCHEME_NORMAL, SCHEME_OCCUPIED, SCHEME_SELECTED, TAGS};
3 3 use anyhow::Result;
4 4 use x11rb::COPY_DEPTH_FROM_PARENT;
5 5 use x11rb::connection::Connection;
@@ -26,7 +26,14 @@ impl Bar {
26 26 let graphics_context = connection.generate_id()?;
27 27
28 28 let width = screen.width_in_pixels;
29 - let height = BAR_HEIGHT;
29 +
30 + let display = unsafe { x11::xlib::XOpenDisplay(std::ptr::null()) };
31 + if display.is_null() {
32 + anyhow::bail!("Failed to open X11 display for XFT");
33 + }
34 + let font = Font::new(display, screen_num as i32, FONT)?;
35 +
36 + let height = font.height() + 4;
30 37
31 38 connection.create_window(
32 39 COPY_DEPTH_FROM_PARENT,
+0 −1 src/config.rs
@@ -8,7 +8,6 @@ use x11rb::protocol::xproto::KeyButMask;
8 8 pub const BORDER_WIDTH: u32 = 1;
9 9 pub const BORDER_FOCUSED: u32 = 0x6dade3;
10 10 pub const BORDER_UNFOCUSED: u32 = 0xbbbbbb;
11 -pub const BAR_HEIGHT: u16 = 32;
12 11 pub const FONT: &str = "JetBrainsMono Nerd Font:size=12";
13 12
14 13 // ========================================