diff --git a/src/main/java/de/bwravencl/controllerbuddy/gui/Main.java b/src/main/java/de/bwravencl/controllerbuddy/gui/Main.java index fb45ffe2..a6927d14 100644 --- a/src/main/java/de/bwravencl/controllerbuddy/gui/Main.java +++ b/src/main/java/de/bwravencl/controllerbuddy/gui/Main.java @@ -2119,7 +2119,18 @@ private void onControllersChanged(final List presentControllers, quitMenuItem.addActionListener(quitAction); popupMenu.add(quitMenuItem); - trayIcon = new TrayIcon(frame.getIconImage()); + final var trayIconSize = systemTray.getTrayIconSize(); + final var trayIconImage = frame.getIconImages().stream() + .filter(iconImage -> iconImage.getWidth(null) == trayIconSize.width + && iconImage.getWidth(null) == trayIconSize.height) + .findFirst() + .orElse(frame.getIconImages().stream() + .max(Comparator + .comparingInt(iconImage -> iconImage.getWidth(null) * iconImage.getHeight(null))) + .orElseThrow() + .getScaledInstance(trayIconSize.width, trayIconSize.height, Image.SCALE_SMOOTH)); + + trayIcon = new TrayIcon(trayIconImage); trayIcon.addActionListener(showAction); trayIcon.setPopupMenu(popupMenu); try {