eclipse.platform.swt icon indicating copy to clipboard operation
eclipse.platform.swt copied to clipboard

shell.setImage - icon is not set on ubuntu 22

Open elaskavaia opened this issue 3 years ago • 5 comments

Describe the bug Setting application icon no longer works on Ubuntu 22 (and RHEL 8) You can also see that eclipse installer and any eclipse apps installed from zip do not have proper icon It works on Ubuntu 20 and below

To Reproduce import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell;

public class MainClass { public static void main(String[] a) { Display d = new Display(); Shell s = new Shell(d); s.setSize(500, 500); s.setImage(new Image(d, "icon.png")); // should be a real .png file in current dir from where it is launched, I used 32 px s.setText("An application icon example"); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); } }

Expected behavior Expected to see icon change in launch bar (usually bar on the left but depends on window manager)

Screenshots Default icon is shown (looks like gears)

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • [] All OS
    • [ ] Windows
    • [x ] Linux
    • [ ] macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc) Ubuntu 22 - default image ubuntu-22.04-desktop-amd64.iso gtk 3.24.33 gtk 2.24.33 gtk 4.6.2

  2. JRE/JDK version - openjdk 11

Version since I did not check other version, it may not work in any I tried 3.120 (gtk)

elaskavaia avatar Jul 20 '22 17:07 elaskavaia

Screenshot from 2022-07-20 13-47-53

this is screenshot of eclipse launcher, but they all look the same

elaskavaia avatar Jul 20 '22 17:07 elaskavaia

Are you using Wayland? You can check in your system settings.

joel-majano avatar Jul 21 '22 17:07 joel-majano

This is out of the box installation of ubuntu-22.04-desktop-amd64.iso - minimal install on virtual box (but I don't think it matter about virual box)? The windowing system is Wayland indeed

Is there is workaround I will be happy to hear about it

elaskavaia avatar Jul 21 '22 20:07 elaskavaia

Looked into this more. It's a result of Wayland not supporting setting icons programatically. See: https://gitlab.gnome.org/GNOME/gtk/-/issues/1602.

Now from some research this by including a *.desktop file with Eclipse. This might need to be accompanied by calling GLib.set_prgname() but not sure about this part. I won't be able to fix this myself but hopefully this helps.

joel-majano avatar Aug 23 '22 18:08 joel-majano

This might be doable in GTK4 now.

  • https://wayland.app/protocols/xdg-toplevel-icon-v1
  • https://docs.gtk.org/gdk4/method.Toplevel.set_icon_list.html (?)

otbutz avatar Feb 05 '25 07:02 otbutz