wslg icon indicating copy to clipboard operation
wslg copied to clipboard

Linux ICON APP not displayed in task bar (need SVG format support)

Open ghost opened this issue 4 years ago • 23 comments
trafficstars

Environment

Platform ServicePack Version VersionString


Win32NT 10.0.21364.0 Microsoft Windows NT 10.0.21364.0

Steps to reproduce

  • Install all the steps, with the latest insider's version
  • with ubuntu 20.04, sudo apt install ubuntu-desktop
  • launch: gedit, nautilus, firefox or any other app

Expected behavior

when launch, the icon of the linux app should be displayed in the task bar

Actual behavior

Problem: In the great video of Craig, we can see the icon of the aplication in the windows task bar with a small linux icon upside, in all the apps i launch, y see a big linux icon, without the app icon

This is a bug?, i must configure some others files?.

image

ghost avatar Apr 23 '21 21:04 ghost

@ferkorol , the taskbar ICON for X11 app is obtained from "_NET_WM_ICON" window property, can you run "xprop" to see if they provide some ICON ? For Wayland native app, the taskbar ICON is obtained from .desktop file. If none of them provides ICON, then the default big penguin Linux icon is used (with overlaying small penguin icon as badge).

hideyukn88 avatar Apr 23 '21 21:04 hideyukn88

Hi!, My wsl2 distro is ubuntu 20.04, xprop dont return anything for nautilus or gedit, but yes the info for firefox, thunderbird and others. A rare case, if i run "sudo nautilus", the first time i have one error, if i try again, it open the root nautilus, and the nautilus icon in this case are displayed correctly in the taskbar. The problem seem to by for my original user.

Any other idea that i can try?

Thanks a lot!!!

ghost avatar Apr 23 '21 23:04 ghost

@ferkorol , I guess in your case nautilus and gedit could be running in Wayland native mode.

First, would you please check if those window shows up in "xwininfo -tree -root"? if it does show up, then it should be running in X11 mode and should respond to "xprop" (like below, this is from gedit in X11 mode).

If it is running in Wayland mode, you can force them to run in X11 mode by "export GDK_BACKEND=x11" first (you might need to restart WSLg if you ever run them in Wayland mode, but I'm not 100% sure on this). I will need to see why only root can reach icon data separately.

FYI: currently running nautilus in X11 mode is hitting separate issue (related to clipboard), so it may crash WSLg. If you encounter this, you will see "read error from data source: Bad address" in /mnt/wslg/weston.log.

_NET_WM_ICON(CARDINAL) = Icon (48 x 48):

                                             ░░░
                                            ░░░░░
                                           ░░░░░
                                          ░░░░░
                                         ░░░░░
                                        ░░░░░
                                       ░░░░░
                                      ░░░░░
                                     ░░░░░
                                    ░░░░░
                                   ░░░░░
                                  ░░░░░
                                 ░░░░░
                                ░░░░░
                               ░░░░░
                              ░░░░░
                             ░░░░░
                            ░░░░░
                           ░░░░░
                          ░░░░░
                         ░░░░░
                        ░░░░░
                       ░░░░░
                      ░░░░░
                ░    ░░░░░
                ▒░    ░░░
                ▒▒░    ░



           ░                                ░

            ░                              ░
             ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

_GTK_WINDOW_OBJECT_PATH(UTF8_STRING) = "/org/gnome/gedit/window/1" _GTK_APPLICATION_OBJECT_PATH(UTF8_STRING) = "/org/gnome/gedit" _GTK_UNIQUE_BUS_NAME(UTF8_STRING) = ":1.0" _GTK_APPLICATION_ID(UTF8_STRING) = "org.gnome.gedit"

hideyukn88 avatar Apr 24 '21 00:04 hideyukn88

And gedit and nautilus seems currently only offer SVG format icon data, and currently WSLg does not support SVG image format for ICON.

hideyukn88 avatar Apr 24 '21 19:04 hideyukn88

Hi!,

image

The export GDK_BACKEND=x11 In my current wsl ubuntu vm i get this error: image

currently WSLg does not support SVG image format for ICON. ->Can i create a custom .desktop with a compatible image to nautilus and others as a temporary solution?.

Regards!

ghost avatar Apr 25 '21 13:04 ghost

@ferkorol , yes you can create custom .desktop file as workaround and have it point to PNG format bitmap as ICON.

With X11 backend, I am able to run nautilus with https://github.com/microsoft/wslg/issues/72 applied.

hideyukn88 avatar Apr 26 '21 02:04 hideyukn88

Good morning!,

Great!, do you know where is the .desktop of the nautilus app?, i replace the icon property of the: /usr/share/applications/nautilus-autorun-software.desktop /usr/share/applications/org.gnome.Nautilus.desktop

Algo i create a custom nautilus.desktop in /home/fer/.local/share/applications

The new icon is a 96x96 png file in my home/Images folder.

Regards!

ghost avatar Apr 28 '21 13:04 ghost

@ferkorol, currently WSLg is not looking desktop files under home directory. I believe /usr/share/applications/org.gnome.Nautilus.desktop is right one, and you can place your new icon at /usr/share/icons/hicolor/96x96/apps. thanks!

hideyukn88 avatar Jun 11 '21 16:06 hideyukn88

I cannot get the icons to work right, unless I am root. In my case, with emacs (installed via apt, Debian 11)

Even with a desktop file pointing directly to the icon (.png or .icon, both don't work):

  • In startup menu under Debian, there is emacs with the pinguin icon
  • When started, in the task bar, there is emacs with the pinguin icon

When using xprop on my emacs the _NET_WM_ICON property is indeed not set (unless I am root, in which case it is set and the icon is fine), but apparently the .desktop file doesn't fix it.

My emacs.desktop:

[Desktop Entry]
Name=Emacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=emacs
Icon=/usr/share/icons/hicolor/128x128/apps/emacs.png
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs

OrbitalHustler avatar Aug 31 '21 00:08 OrbitalHustler

I've been looked into the code and found the SVG format has been supported in "img-load.c" by using librsvg2 lib. However the build Dockerfile doesn't include that as building dependency, so this will be disabled at current release.

pixman_image_t *
load_icon_image(struct desktop_shell *shell, const char *filename)
{
	pixman_image_t *image;
	image = load_image(filename);
#ifdef HAVE_LIBRSVG2
	if (!image)
		image = load_svg(shell, filename);
#endif // HAVE_LIBRSVG2
	return image;
}

It won't be easy to add librsvg2 to the build environment because Microsoft's repository doesn't have that lib. I've tried to build it from source code but it says the Rust runtime was too old( 1.42 < required 1.5x)

seflerZ avatar Oct 15 '21 11:10 seflerZ

any update on this? appears to still be broken

theironrobin avatar Aug 10 '22 04:08 theironrobin

@theironrobin, I completed the SVG support PR, https://github.com/microsoft/wslg/pull/798, but there is an issue with fontconfig with only x64 while arm64 build works, we are investigating that, thanks!

hideyukn88 avatar Aug 10 '22 17:08 hideyukn88

@theironrobin Please refer the comment I made in the PR, you should do some code modifications and it works. If you just want to enable the Icon, I can send you a modified WSL system VHD to you.

seflerZ avatar Aug 12 '22 03:08 seflerZ

@seflerZ, I merged the PR, but noticed the issue with pango/fontconfig text rendering on x64 (arm64 is working fine), which causes the title bar text with X11 application does not render correctly, thus reverted back the PR. Have you noticed such? thanks!

hideyukn88 avatar Aug 12 '22 03:08 hideyukn88

@seflerZ, I merged the PR, but noticed the issue with pango/fontconfig text rendering on x64 (arm64 is working fine), which causes the title bar text with X11 application does not render correctly, thus reverted back the PR. Have you noticed such? thanks!

No, I haven't. Everything works fine.

image

I'm using a customized theme. Maybe saved me?

image

seflerZ avatar Aug 12 '22 09:08 seflerZ

I don't understand why code has to be patched manually for this to work? why can't @seflerZ add the scalable icon paths in a PR rather than comment.

alex-startengine avatar Aug 12 '22 15:08 alex-startengine

@seflerZ, thanks for screenshot, and this is very interesting. Below is what I got with enabling librsvg2, please see the title bar fonts are all boxes. Would you please try firefox. xclock and xcalc?

image

And here is some findings...

• If a process only uses pango (even librsvg2 is installed on system), pango works fine to render font glyph. • If a process only uses librsvg2 (even pango is installed on system), librsvg2 works fine to decode SVG image. • But if a process loads both pango and librsvg2 libraries, while librsvg2 works fine, but pango is failing to render font glyph, and our compositor is falling this case.

If yours is still working fine with those X11 apps, I would be very interested in to look into that. If you don't mind, would you please share your private VHD file? thanks!

hideyukn88 avatar Aug 12 '22 18:08 hideyukn88

Hello @hideyukn88 , everything works fine.

image

I'm using Ubuntu 22.04 with WSLg.

seflerZ avatar Aug 13 '22 02:08 seflerZ

I don't understand why code has to be patched manually for this to work? why can't @seflerZ add the scalable icon paths in a PR rather than comment.

It is because I'm also hard coded my theme path to that dir string. At present, I can't come up with an idea to get user applied theme in the WSL system image. They are isolated. @hideyukn88 do you have any idea?

seflerZ avatar Aug 13 '22 02:08 seflerZ

@seflerZ, one of issue is that currently theme data file installed at user-distro is not accessible from system distro, but we can change this to be shared with system distro (as currently we are working on xfonts on user-distro to be shared for system distro).

And I'm still would like to check why enabling SVG doesn't cause issue with font rendering on your image, so if you don't mind, please share your system distro VHD with us, thank you!

hideyukn88 avatar Aug 16 '22 20:08 hideyukn88

@hideyukn88 Sure, you can download it here. If it still doesn't work, try to change the font.

seflerZ avatar Aug 17 '22 03:08 seflerZ

I was having this problem about the icon on the taskbar. The app (Zathura) was running on Wayland. Changing for X11 solved the problem.

But I actually prefer the Wayland visual. Is there any other way to keep the Wayland and make the icon correct?

(Sorry for english)

NicoCassio avatar Oct 04 '24 02:10 NicoCassio

As per https://github.com/microsoft/wslg/issues/614#issuecomment-1006143044 https://github.com/microsoft/CBL-MarinerCoreUI/pull/95 was holding up svg support in wslg's wayland implementation. Is that fixed now @hideyukn88 ?

This is still an issue in WSL 2.4.5, where I am getting the penguin icon in the task bar when I launch wayland apps such as ptyxis.

satmandu avatar Dec 06 '24 15:12 satmandu