Skip to content

Conversation

@arebaka
Copy link

@arebaka arebaka commented May 29, 2025

This PR adds support for a new configuration option and command-line flag: min-icon-size. This setting ensures that icons in notifications are not rendered too small, especially in cases where the icon file (e.g. .svg or low-res .png) is smaller than desired.

Previously, icons were rendered at their native size. This often led to extremely small icons in notifications (e.g. 16x16px icons on high-DPI screens), making them barely visible. Now, Mako will check the dimensions of the loaded icon and, if the largest side is smaller than min-icon-size, it will reload the image using gdk_pixbuf_new_from_file_at_scale() to upscale it to the minimum size while maintaining aspect ratio.

Was:
изображение

Became:
изображение

Changes:

  • New min-icon-size configuration key
    Example:
    min-icon-size = 32

  • New command-line override: --min-icon-size=N

  • Scaling logic:
    After loading the icon image (via gdk_pixbuf_new_from_file()), check if its width or height is less than min-icon-size.
    If so, reload the image using gdk_pixbuf_new_from_file_at_scale() with the minimum dimension.
    Aspect ratio is preserved.

Benefits:

  • Improves visibility and aesthetics of notifications using small icons.
  • Particularly useful for .svg icons or legacy bitmap icons at low resolutions.
  • Works seamlessly with both old icon-path logic and new icon-theme lookup Use libsfdo-based symbolic/scalable/SVG icon lookup #584 (if present).

Compatibility:

  • The new min-icon-size option is optional.
  • If unset, Mako retains its original icon rendering behavior.
  • Fully backward compatible with existing configurations.

Testing:

  • Verified behavior with small PNG icons (16x16) and scalable SVG icons.
  • Confirmed that large icons are unaffected.
  • Checked integration with both icon lookup paths (libsfdo and legacy glob).

Closes #464
CC: @arebaka

@grolongo
Copy link

Also useful for a color picker script. I have one that selects a 1x1 pixel on the screen and sends a notification showing the hex color code with the actual color as an icon.

This is how it shows on dunst:
dunst

and mako:
mako

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: min-icon-size

2 participants