diff --git a/config.def.h b/config.def.h index bcdf40b..2d5e173 100644 --- a/config.def.h +++ b/config.def.h @@ -23,7 +23,6 @@ int word_wrap = False; int line_height = 0; /* if line height < font height, it will be raised to font height */ int separator_enabled = False; -float separator_total_height = 1; /* height of the complete separator */ float separator_width = 0.7; /* width in relation to window width */ float separator_height = 0.1; /* height in relation to line_height */ enum separator_color sep_color = AUTO; /* AUTO or FOREGROUND */ diff --git a/dunst.c b/dunst.c index 3d08baa..e37db52 100644 --- a/dunst.c +++ b/dunst.c @@ -573,6 +573,12 @@ void draw_win(void) line_cnt += n->draw_txt_buf.line_count; } + if (separator_enabled) { + line_cnt += l_length(displayed_notifications) - 1; + if (indicate_hidden && !l_is_empty(notification_queue)) + line_cnt++; + } + /* if we have a dynamic width, calculate the actual width */ if (width == 0) { for (l_node * iter = displayed_notifications->head; iter; @@ -595,10 +601,6 @@ void draw_win(void) height = MAX(geometry.h, (line_cnt * line_height)); } - int separator_total_pix_height = separator_total_height * line_height; - if (separator_enabled) - height += (line_cnt - 1) * separator_total_pix_height; - /* add "(x more)" */ draw_txt x_more; x_more.txt = NULL; @@ -664,7 +666,7 @@ void draw_win(void) /* draw separator */ if (separator_enabled && line_cnt > 1) { dc->x = 0; - drawrect(dc, 0, 0, width, separator_total_pix_height, True, n->colors->BG); + drawrect(dc, 0, 0, width, line_height, True, n->colors->BG); double color; if (sep_color == AUTO) @@ -672,17 +674,13 @@ void draw_win(void) else color = n->colors->FG; - int new_y = dc->y + separator_total_pix_height; - int sep_pix_height = line_height * separator_height; - - sep_pix_height = sep_pix_height < 1 ? 1 : sep_pix_height; - if (sep_pix_height > separator_total_pix_height) - sep_pix_height = separator_total_pix_height; - - int sep_pix_width = width * separator_width; - dc->y = dc->y + (separator_total_pix_height - sep_pix_height) / 2; - dc->x = (width - sep_pix_width) / 2; - drawrect(dc, 0, 0, sep_pix_width, sep_pix_height, True, color); + int new_y = dc->y + line_height; + int sep_height = line_height * separator_height; + sep_height = sep_height < 1 ? 1 : sep_height; + int sep_width = width * separator_width; + dc->y = dc->y + (line_height - sep_height) / 2; + dc->x = (width - sep_width) / 2; + drawrect(dc, 0, 0, sep_width, sep_height, True, color); dc->y = new_y; } } @@ -1582,8 +1580,6 @@ dunst_ini_handle(void *user_data, const char *section, separator_width = strtod(value, NULL); if (strcmp(name, "height") == 0) separator_height = strtod(value, NULL); - if (strcmp(name, "total_height") == 0) - separator_total_height = strtod(value, NULL); if (strcmp(name, "color") == 0) { char *str = dunst_ini_get_string(value); if (strcmp(str, "auto") == 0) diff --git a/dunstrc b/dunstrc index e5e3875..2532cdd 100644 --- a/dunstrc +++ b/dunstrc @@ -68,18 +68,13 @@ [separator] - # Draw a separator between notifications? + #enable drawing of separator line enable = no - # total height of the separator in relation to line height - total_height = 0.3 - - # width of the separator decoration + #width of separator line in relation to window width width = 0.8 - - # height of the separator decoration - height = 0.8 - + #height of separator line in relation to line height + height = 0.3 # color can either be "foreground" to use the foreground color or # "auto" to generate a fitting color depending on the background color