naughty: Make sure the icon cannot be bigger then the box.

Without this change, parts of the icon were hidden.
This commit is contained in:
Emmanuel Lepage Vallee 2019-01-04 01:05:36 -05:00
parent bfda6f64bb
commit e70822a6a4
1 changed files with 8 additions and 0 deletions

View File

@ -465,6 +465,14 @@ function naughty.default_notification_handler(notification, args)
iconbox = wibox.widget.imagebox()
iconmargin = wibox.container.margin(iconbox, margin, margin, margin, margin)
if max_height and icon:get_height() > max_height then
icon_size = icon_size and math.min(max_height, icon_size) or max_height
end
if max_width and icon:get_width() > max_width then
icon_size = icon_size and math.min(max_width, icon_size) or max_width
end
if icon_size and (icon:get_height() > icon_size or icon:get_width() > icon_size) then
size_info.icon_scale_factor = icon_size / math.max(icon:get_height(),
icon:get_width())