mako icon indicating copy to clipboard operation
mako copied to clipboard

Add min-icon-size option to enforce minimum icon dimensions

Open arebaka opened this issue 7 months ago • 1 comments

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 #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

arebaka avatar May 29 '25 21:05 arebaka

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

grolongo avatar Oct 14 '25 18:10 grolongo