From 80fd31b32c33ae5878bc0b6389a5490663e27c6b Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Fri, 17 Aug 2012 03:29:18 +0300 Subject: [PATCH] add bar width and leading offset configuration options --- bar.c | 13 ++++++------- config.def.h | 4 ++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bar.c b/bar.c index 0740f4c..139c825 100644 --- a/bar.c +++ b/bar.c @@ -322,21 +322,20 @@ init (void) /* Grab infos from the first screen */ scr = xcb_setup_roots_iterator (xcb_get_setup (c)).data; - bar_width = scr->width_in_pixels; root = scr->root; + /* where to place the window */ + y = (bar_bottom) ? (scr->height_in_pixels - BAR_HEIGHT) : 0; + bar_width = (BAR_WIDTH < 0) ? (scr->width_in_pixels - OFFSET) : BAR_WIDTH; + /* Load the font */ if (font_load ((const char* []){ BAR_FONT })) exit (1); /* Create the main window */ win = xcb_generate_id (c); - if (bar_bottom) - y = scr->height_in_pixels - BAR_HEIGHT; - else - y = 0; - xcb_create_window (c, XCB_COPY_FROM_PARENT, win, root, 0, y, - bar_width, BAR_HEIGHT, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, scr->root_visual, + xcb_create_window (c, XCB_COPY_FROM_PARENT, win, root, OFFSET, y, bar_width, + BAR_HEIGHT, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, scr->root_visual, XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK, (const uint32_t []){ palette[0], XCB_EVENT_MASK_EXPOSURE }); /* Set EWMH hints */ diff --git a/config.def.h b/config.def.h index d81ce55..e939e0d 100644 --- a/config.def.h +++ b/config.def.h @@ -1,5 +1,9 @@ /* The height of the bar (in pixels) */ #define BAR_HEIGHT 18 +/* The width of the bar. Set to -1 to fit screen */ +#define BAR_WIDTH -1 +/* Offset from the left. Set to 0 to have no effect */ +#define OFFSET 0 /* Choose between an underline or an overline */ #define BAR_UNDERLINE 1 /* The thickness of the underline (in pixels). Set to 0 to disable. */