diff --git a/docs/dunst.5.pod b/docs/dunst.5.pod index b08c35469..8f0e0ab5b 100644 --- a/docs/dunst.5.pod +++ b/docs/dunst.5.pod @@ -188,11 +188,25 @@ than half of the progress bar height. The corner radius of the progress bar in pixels. Gives the progress bar rounded corners. Set to 0 to disable. +=item B (default: all) + +Define which corners to round when drawing the progress bar. If progress_bar_corner_radius +is set to 0 this option will be ignored. + +See the B setting for the value format. + =item B (default: 0) The corner radius of the icon image in pixels. Gives the icon rounded corners. Set to 0 to disable. +=item B (default: all) + +Define which corners to round when drawing the icon image. If icon_corner_radius +is set to 0 this option will be ignored. + +See the B setting for the value format. + =item B (values: [true/false], default: true) If this is set to true, a notification indicating how many notifications are diff --git a/dunstrc b/dunstrc index c97509317..a8b433851 100644 --- a/dunstrc +++ b/dunstrc @@ -63,9 +63,17 @@ # Corner radius for the progress bar. 0 disables rounded corners. progress_bar_corner_radius = 0 + # Define which corners to round when drawing the progress bar. If progress_bar_corner_radius + # is set to 0 this option will be ignored. + progress_bar_corners = all + # Corner radius for the icon image. icon_corner_radius = 0 + # Define which corners to round when drawing the icon image. If icon_corner_radius + # is set to 0 this option will be ignored. + icon_corners = all + # Show how many messages are currently hidden (because of # notification_limit). indicate_hidden = yes diff --git a/src/draw.c b/src/draw.c index de194ef21..ac324d053 100644 --- a/src/draw.c +++ b/src/draw.c @@ -808,8 +808,7 @@ static void render_content(cairo_t *c, struct colored_layout *cl, int width, dou } // else ICON_RIGHT cairo_set_source_surface(c, cl->icon, round(image_x * scale), round(image_y * scale)); - // icon_corners - draw_rounded_rect(c, image_x, image_y, image_width, image_height, settings.icon_corner_radius, scale, settings.corners); + draw_rounded_rect(c, image_x, image_y, image_width, image_height, settings.icon_corner_radius, scale, settings.icon_corners); cairo_fill(c); } @@ -849,17 +848,16 @@ static void render_content(cairo_t *c, struct colored_layout *cl, int width, dou * this solution is not particularly solid (basically subracting a pixel or two) */ - // progress_bar_corners // back layer (background) cairo_set_source_rgba(c, cl->bg.r, cl->bg.g, cl->bg.b, cl->bg.a); draw_rounded_rect(c, x_bar_2, frame_y, progress_width_2, progress_height, - settings.progress_bar_corner_radius, scale, settings.corners); + settings.progress_bar_corner_radius, scale, settings.progress_bar_corners); cairo_fill(c); // top layer (fill) cairo_set_source_rgba(c, cl->highlight.r, cl->highlight.g, cl->highlight.b, cl->highlight.a); draw_rounded_rect(c, x_bar_1, frame_y, progress_width_1, progress_height, - settings.progress_bar_corner_radius, scale, settings.corners); + settings.progress_bar_corner_radius, scale, settings.progress_bar_corners); cairo_fill(c); // border @@ -871,7 +869,7 @@ static void render_content(cairo_t *c, struct colored_layout *cl, int width, dou progress_width - frame_width - 2, progress_height, settings.progress_bar_corner_radius, - scale, settings.corners); + scale, settings.progress_bar_corners); cairo_stroke(c); } } diff --git a/src/settings.h b/src/settings.h index 62af2b924..8b1ce871a 100644 --- a/src/settings.h +++ b/src/settings.h @@ -151,6 +151,8 @@ struct settings { int progress_bar_corner_radius; int icon_corner_radius; enum corner_pos corners; + enum corner_pos progress_bar_corners; + enum corner_pos icon_corners; bool progress_bar; enum zwlr_layer_shell_v1_layer layer; enum origin_values origin; diff --git a/src/settings_data.h b/src/settings_data.h index 00e1bd117..1d65e08b9 100644 --- a/src/settings_data.h +++ b/src/settings_data.h @@ -1047,6 +1047,26 @@ static const struct setting allowed_settings[] = { .parser = string_parse_corners, .parser_data = corners_enum_data, }, + { + .name = "progress_bar_corners", + .section = "global", + .description = "Select the corners to round for the progress bar", + .type = TYPE_CUSTOM, + .default_value = "all", + .value = &settings.progress_bar_corners, + .parser = string_parse_corners, + .parser_data = corners_enum_data, + }, + { + .name = "icon_corners", + .section = "global", + .description = "Select the corners to round for the icon image", + .type = TYPE_CUSTOM, + .default_value = "all", + .value = &settings.icon_corners, + .parser = string_parse_corners, + .parser_data = corners_enum_data, + }, { .name = "progress_bar_height", .section = "global",