Icon support in WSL / WSLg with native linux applications [fixed with WSL v1.1.7, broken again with WSL v1.2.x]

some icons in taskbar for linux applications are defaulting to Tux
wsl
Published

March 3, 2023

Problem

As I have explained in https://github.com/microsoft/wslg/issues/944

some icons are missing and defaulting to Tux

image.png

Update April/21 23: with WSL v1.2.x, this has been broken again.

https://github.com/microsoft/wslg/issues/944#issuecomment-1517301808

image.png

Here is the changelog of WSL 1.2.5

Update April/4 23: with WSL v1.1.7, this has been fixed.

image.png

Here is the changelog of WSL 1.1.7

What works

In Start Menu

Now that X11 apps are inserted into Windows Start Menu

image.png

shortcuts to X11 apps

Those entries are like other native windows ones.

They are located at %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\ubuntu-22.04 (where ubuntu-22.04 is the name of my distrib)

and we can update those icons (right click > Plus > Open file location)

image.png %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\ubuntu-22.04

add new icons

We can now right click these entries, update icon. When installing apps, WSLg is creating icon entries into %USERPROFILE%\AppData\Local\Temp\WSLDVCPlugin\ubuntu-22.04\ (where ubuntu-22.04 is still the name of my distrib) I can add mine in that location

image.png %USERPROFILE%\AppData\Local\Temp\WSLDVCPlugin\ubuntu-22.04\

(optional) from png to icon with zsh

I can’t believe we cannot use png files as icon in Windows.

However how to easily turn png file to ico file using zsh?

Create png2ico.zsh in ~/bin

#!/usr/bin/zsh
png2ico () {
    local i="${1}" o="${2:-${1:r}.ico}" 
    convert "$i" -define icon:auto-resize=256,128,64,48,32,16 "$o"
}

Create ico from png

source ~/bin/png2ico.zsh
png2ico tilix_icon.png

image.png ico file created

You can move it to %USERPROFILE%\AppData\Local\Temp\WSLDVCPlugin\ubuntu-22.04\, and update Tilix entry from %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\ubuntu-22.04 to use this new ico file

We can pin them in the Task bar, and in the Start screen

image.png

image.png

but when running them, this is a different story

image.png

What works a little bit