Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set icon image corner radius #1139

Merged
merged 2 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/dunst.5.pod
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ 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<icon_corner_radius> (default: 0)

The corner radius of the icon image in pixels. Gives the icon
rounded corners. Set to 0 to disable.

=item B<indicate_hidden> (values: [true/false], default: true)

If this is set to true, a notification indicating how many notifications are
Expand Down
2 changes: 2 additions & 0 deletions dunstrc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
# Corner radius for the progress bar. 0 disables rounded corners.
progress_bar_corner_radius = 0

# Corner radius for the icon image.
icon_corner_radius = 0

# Show how many messages are currently hidden (because of
# notification_limit).
Expand Down
2 changes: 1 addition & 1 deletion src/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,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));
draw_rect(c, image_x, image_y, image_width, image_height, scale);
draw_rounded_rect(c, image_x, image_y, image_width, image_height, settings.icon_corner_radius, scale, true, true);
cairo_fill(c);
}

Expand Down
1 change: 1 addition & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ struct settings {
int progress_bar_max_width;
int progress_bar_frame_width;
int progress_bar_corner_radius;
int icon_corner_radius;
bool progress_bar;
enum zwlr_layer_shell_v1_layer layer;
enum origin_values origin;
Expand Down
10 changes: 10 additions & 0 deletions src/settings_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,16 @@ static const struct setting allowed_settings[] = {
.parser = NULL,
.parser_data = NULL,
},
{
.name = "icon_corner_radius",
.section = "global",
.description = "Icon corner radius",
.type = TYPE_INT,
.default_value = "0",
.value = &settings.icon_corner_radius,
.parser = NULL,
.parser_data = NULL,
},
{
.name = "progress_bar",
.section = "global",
Expand Down