Add min-icon-size option to enforce minimum icon dimensions#585
Open
arebaka wants to merge 3 commits intoemersion:masterfrom
Open
Add min-icon-size option to enforce minimum icon dimensions#585arebaka wants to merge 3 commits intoemersion:masterfrom
arebaka wants to merge 3 commits intoemersion:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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:
Compatibility:
Testing:
Closes #464
CC: @arebaka