diff --git a/awesomerc.5.txt b/awesomerc.5.txt index 49db4153c..37a44b894 100644 --- a/awesomerc.5.txt +++ b/awesomerc.5.txt @@ -55,6 +55,7 @@ List of awesome markup and their attribute: * margin - left: left margin in pixel - right: right margin in pixel + - top: top margin in pixel * text - align: text alignment - shadow: shadow color diff --git a/common/draw.c b/common/draw.c index 6b928b8a3..232b48a58 100644 --- a/common/draw.c +++ b/common/draw.c @@ -296,6 +296,8 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem, case A_TK_RIGHT: data->margin.right = atoi(*values); break; + case A_TK_TOP: + data->margin.top = atoi(*values); default: break; } @@ -419,7 +421,7 @@ draw_text(draw_context_t *ctx, font_t *font, /* + 1 is added for rounding, so that in any case of doubt we rather draw * the text 1px lower than too high which usually results in a better type * face */ - y = area.y + (ctx->height - font->height + 1) / 2; + y = area.y + (ctx->height - font->height + 1) / 2 + pdata->margin.top; switch(pdata->align) { diff --git a/common/draw.h b/common/draw.h index 3f5a9968d..a61f97b76 100644 --- a/common/draw.h +++ b/common/draw.h @@ -179,7 +179,7 @@ typedef struct alignment_t align; struct { - int left, right; + int left, right, top; } margin; bool has_bg_color; xcolor_t bg_color;