Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to fix a problem I found with a Java application. It has a too low res icon. After reading the source of it I modified it to have a bigger icon. SWT uses the gtk_window_set_icon() function of GTK to set the icon.

However, the high resolution icon is not used.

There is a work around of using a .desktop file to have a nice icon described here. And others describe the problem on the Ubuntu forums.

So how can I have a nice icon without having to place a .desktop file in the filesystem? Where should I report the bug for this? In which package is the code downscaling the icon that I intend to pass to the window manager?

I appreciate some help on this.

This can be reproduced with the following code:

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Test {
  public static void main(String[] args) {
    Display display = new Display();

    final int SIZE = 256;
    Image large = new Image(display, SIZE, SIZE);
    GC gc = new GC(large);
    gc.fillArc(0, 0, SIZE, SIZE, 45, 270);

    Shell shell = new Shell(display);
    shell.setImages(new Image[] {  large });;

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())

share|improve this question
It's probably GTK down-sizing it to something that makes sense in a window's title bar. Why don't you want to use the .desktop file? – mhall119 Jan 22 '13 at 0:11
As it is a Java project most the time it is not even installed. So I cannot copy the .desktop file to the appropriate places in the system. Moreover, I am actually using gtk_window_set_icon_list () which passes many icons to GTK, so the right (bigger) one should be chosen for ALT-TAB. – Felix Möller Jan 22 '13 at 6:45
@FelixMöller I feel that's more of an answer! Please post answers as answers. – gertvdijk Jan 22 '13 at 9:16
I see no solution at all. I just tried to explain why I do not want to use a .desktop file. – Felix Möller Jan 22 '13 at 17:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.