Skip to content

Commit 03c3953

Browse files
committed
Workaround for OpenBox (Thanks ma @ arch bbs). Handle some fonts better.
1 parent febe0f8 commit 03c3953

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

bar.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ draw_char (int x, int align, wchar_t ch)
9090
sel_font->table[ch - sel_font->char_min].character_width :
9191
0;
9292

93-
93+
/* Some fonts (such as anorexia) have the space char with the width set to 0 */
9494
if (ch_width == 0)
95-
return 0;
95+
ch_width = BAR_FONT_FALLBACK_WIDTH;
9696

9797
switch (align) {
9898
case ALIGN_C:
@@ -360,6 +360,9 @@ init (void)
360360

361361
/* Make the bar visible */
362362
xcb_map_window (c, win);
363+
/* Send a configure event. Needed to make bar work with Openbox */
364+
xcb_configure_window (c, win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, (const uint32_t []){ BAR_OFFSET, y });
365+
363366
xcb_flush (c);
364367
}
365368

config.def.h

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#define BAR_BOTTOM 0
1313
/* The fonts used for the bar, comma separated. Only the first 2 will be used. */
1414
#define BAR_FONT "-*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1","fixed"
15+
/* Some fonts don't set the right width for some chars, pheex it */
16+
#define BAR_FONT_FALLBACK_WIDTH 6
1517
/* Color palette */
1618
#define COLOR0 0x1A1A1A /* background */
1719
#define COLOR1 0xA9A9A9 /* foreground */

0 commit comments

Comments
 (0)