wslg: WSLg doesn't pick up the actual icons of Linux desktop apps

Environment

Windows build number: Microsoft Windows [Version 10.0.22000.348]
Your Distribution version:  Ubuntu 20.04
Your WSLg version: 1.0.26

Steps to reproduce

Just run any Linux GUI from the command line or the Windows start menu. All apps have the generic Linux logo icon, which makes them hard to differentiate.

I’ve installed all apps with apt install.

Expected behavior

I expect each app to display it’s all icon (as defined by appname.desktop).

Actual behavior

image

The same generic icon is displayed in the taskbar as well. Interestingly, when I run Emacs as root it displays the right icon.

image

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 13
  • Comments: 17 (3 by maintainers)

Most upvoted comments

I am having the same issue and could not resolve it reading the above. For example, I installed Gitkraken:

wget https://release.gitkraken.com/linux/gitkraken-amd64.deb
sudo apt install ./gitkraken-amd64.deb

Then I launch it:

gitkraken

I see the generic icon.

Here are the logs:

❯ cat /mnt/wslg/weston.log

[13:44:37.885] set_position_from_xwayland: XWM 860, 302; geometry 32, 32; view 828, 270
[13:44:37.901] app_list_monitor_thread: loadIconEvent is signalled. GitKraken
[13:44:37.901] app_list_monitor_thread: entry (nil), image (nil)
[13:44:37.937] Client: ClientGetAppidReq: pid:9707 appId:GitKraken
[13:44:40.489] set_position_from_xwayland: XWM 334, 140; geometry 32, 32; view 302, 108
[13:44:40.548] app_list_monitor_thread: loadIconEvent is signalled. GitKraken
[13:44:40.548] app_list_monitor_thread: entry (nil), image (nil)
[13:44:40.649] Client: ClientGetAppidReq: pid:9707 appId:GitKraken

Any idea how to fix this?

Should I add a /usr/share/applications/GitKraken.desktop icon? What format should the icon be?


ANSWER: Nevermind, I was able to find the solution. There was a gitkraken.desktop file, so I renamed it to match the AppId GitKraken.desktop and it works.

That being said, is there a way to change the generic linux icon displayed on top of the icon based on the distro? When using the same softwares in different distros, it’s impossible to know which one is which as they all look the same.

Yzs8B5Jwxp

This is because current WSLg doesn’t support SVG icons. Though this function code has been added but the corresponding SVG lib can’t be found in Mariner (A Microsfoft linux distro) repository. Refer to this to has more details.

Thank you very much @andnig, following the cache refresh tip from that MS answer I finally got the icons to work for the task bar as well.

EDIT: For reasons I can’t comprehend, the taskbar shows the correct window just as of today. 3 windows restarts (not weston, the full OS) were in between but nothing else was changed. So my below comment is not valid anymore. Quick recap what I did and what works now:

  • Create a file /usr/share/applications/kitty.desktop (with Icon=kitty)
  • Put an appropriately sized ‘kitty.png’ file in all folders /usr/share/icons/hicolor/$size/apps/ (with size being 128x128, 16x16, 256x256, 32x32, 512x512, 64x64)

EDIT2: Ok there seems to be an icon cache in windows, didn’t know that. So, after following the steps above, make sure to refresh the icon cache. Follow the second answer (user Omoikane1122) in this MS answer

------------ original comment -----------------

I have a similar issue, but none of the workarounds helped so far. All the icons are correctly set in the start menu, however not in the task bar. image

Task bar: image

WSL version: 2.0.14.0 WSLg version: 1.0.59

For eg. for kitty, my desktop file is at /usr/share/applications/kitty.desktop, Icon is set to ‘kitty’ and there is an appropriately sized ‘kitty.png’ file in folders /usr/share/icons/hicolor/$size/apps/ (with size being 128x128, 16x16, 256x256, 32x32, 512x512, 64x64)

Is there a chance to get the icons also working on the task bar? Where do we need to put the icons so that they are used in the taskbar?

Another use case is when using an AppImage. In that case, there is no entry in /usr/share/applications/ so it’s not a mismatch of AppId. Any workaround to this?

Thanks

It looks like weston doesn’t look for icons in /usr/local/share/icons/ As a workaround for emacs I edited file /usr/local/share/applications/emacs.desktop and changed Icon to emacs29 and copied icon files from emacs checkout to /usr/share/icons

cd $EMACS_CODE/etc/images/icons/hicolor/
for d in *                                                                                                                                                                                                                            
do
sudo cp $d/apps/emacs.png /usr/share/icons/hicolor/$d/apps/emacs29.png
done

Restarted wslg and emacs now has emacs icon in windows.