|
|
@@ -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, |