diff --git a/statusbar.c b/statusbar.c index bd06cb020..d3725d6b2 100644 --- a/statusbar.c +++ b/statusbar.c @@ -265,7 +265,7 @@ statusbar_position_update(statusbar_t *statusbar, position_t position) { case Right: case Left: - if(statusbar->width <= 0) + if(!statusbar->width_user) statusbar->width = area.height; statusbar->sw = simplewindow_new(globalconf.connection, statusbar->phys_screen, 0, 0, @@ -285,7 +285,7 @@ statusbar_position_update(statusbar_t *statusbar, position_t position) statusbar->colors.bg); break; default: - if(statusbar->width <= 0) + if(!statusbar->width_user) statusbar->width = area.width; statusbar->sw = simplewindow_new(globalconf.connection, statusbar->phys_screen, 0, 0, @@ -558,6 +558,8 @@ luaA_statusbar_new(lua_State *L) (*sb)->align = draw_align_get_from_str(luaA_getopt_string(L, 1, "align", "left")); (*sb)->width = luaA_getopt_number(L, 1, "width", 0); + if((*sb)->width > 0) + (*sb)->width_user = true; (*sb)->height = luaA_getopt_number(L, 1, "height", 0); if((*sb)->height <= 0) /* 1.5 as default factor, it fits nice but no one knows why */ diff --git a/structs.h b/structs.h index 45d3dd8c4..fccacd562 100644 --- a/structs.h +++ b/structs.h @@ -202,6 +202,8 @@ struct statusbar_t int width; /** Bar height */ int height; + /** True if user specified width */ + bool width_user; /** Bar position */ position_t position; /** Alignment */