Skip to content

Commit

Permalink
Try using smaller icon versions in WS overview
Browse files Browse the repository at this point in the history
It looks better having a smaller (even if not well recognizable) icon
than not having an icon at all, especially with mid/large sized themes.
  • Loading branch information
Code7R committed Oct 27, 2024
1 parent 2a41893 commit 0f927a3
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/aworkspaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -776,15 +776,21 @@ void WorkspaceButton::paint(Graphics &g, const YRect& r) {
g.setColor(colors[2]);
g.fillRect(wx+1, wy+1, ww-2, wh-2);

if (pagerShowWindowIcons &&
ww > 1 + int(smallIconSize) &&
wh > 1 + int(smallIconSize) &&
(icon = yfw->getIcon()) != null &&
icon->small() != null)
{
g.drawImage(icon->small(),
wx + (ww-smallIconSize)/2,
wy + (wh-smallIconSize)/2);
for (auto &xsize : {64, 48, 32, 24, 22, 16}) {
if (xsize > int(smallIconSize))
continue;
if (pagerShowWindowIcons && ww > 1 + int(xsize) &&
wh > 1 + int(xsize) &&
(icon = yfw->getIcon()) != null &&
icon->small() != null) {
g.drawImage(icon->getScaledIcon(xsize),
wx + (ww - xsize) / 2,
wy + (wh - xsize) / 2);

// stop trying at smallIconSize or whichever size
// below fits it
break;
}
}
}
g.setColor(colors[5]);
Expand Down

0 comments on commit 0f927a3

Please sign in to comment.