Skip to content

Commit b9cd51a

Browse files
authored
Merge pull request Alexays#548 from Psykar/icon-width
Keep aspect ratio when scaling tray icons.
2 parents 9c8d086 + 569f40d commit b9cd51a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/modules/sni/item.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,11 @@ void Item::updateImage() {
265265
if (pixbuf->gobj() != nullptr) {
266266
// An icon specified by path and filename may be the wrong size for
267267
// the tray
268-
pixbuf = pixbuf->scale_simple(icon_size, icon_size, Gdk::InterpType::INTERP_BILINEAR);
268+
// Keep the aspect ratio and scale to make the height equal to icon_size
269+
// If people have non square icons, assume they want it to grow in width not height
270+
int width = icon_size * pixbuf->get_width() / pixbuf->get_height();
271+
272+
pixbuf = pixbuf->scale_simple(width, icon_size, Gdk::InterpType::INTERP_BILINEAR);
269273
image.set(pixbuf);
270274
}
271275
} else {

0 commit comments

Comments
 (0)