Open castorfou opened 1 year ago
@castorfou, thanks for reporting the issue. Currently WSLg can't show some Wayland applications points SVG format bitmap as icon, such as nautilus and many of gnome applications, there is existing issue opened at https://github.com/microsoft/wslg/issues/70, but for Sublime-text, at my end, does show correct icon, as below, the screen capture shows two icons for nautilus and sublime-text. While nautilus shows default tux icon, sublime-text shows its own application's icon. How do you install sublime-text? thanks!
I have installed sublime-text with snap.
@castorfou, thanks. I did install by apt-get. But when installed by snap, icon is placed under snap folder rather than /usr/share/icons, thus icon needs to be located from .desktop file, and WSLg relys on the application to set their desktop file name in set_app_id protocol, as documented as the best practice in the Wayland document, https://wayland.app/protocols/xdg-shell#xdg_toplevel:request:set_app_id. But sublime-text doesn't follow that, thus WSLg is not able to look up .desktop (then icon file), thus default is used. I will look into how other distro who is using Wayland does. Thanks!
thank you @hideyukn88
is there a (easy) workaround to modify applications such as sublime-text not following wayland policy?
@castorfou, for sublime-text, you can rename /var/lib/snapd/desktop/applications/sublime-text_subl.desktop
to /var/lib/snapd/desktop/applications/sublime_text.desktop
. Since the application reports "sublime_text" as their app_id, just rename its .desktop file to same as it's app_id, thanks!
@hideyukn88, note to self, the most of snap allocation set desktop file path in BAMF_DESKTOP_FILE_HINT, thus if there is a way to access running process's environment variables from our rdprail-shell, the shell can look up desktop file even the application doesn't set exactly same app_id as desktop file name.
@castorfou, for sublime-text, you can rename
/var/lib/snapd/desktop/applications/sublime-text_subl.desktop
to/var/lib/snapd/desktop/applications/sublime_text.desktop
. Since the application reports "sublime_text" as their app_id, just rename its .desktop file to same as it's app_id, thanks!
Thank you that worked perfectly. I have not followed strictly this process though.
cd /var/lib/snapd/desktop/applications
sudo ln -s sublime-text_subl.desktop sublime_text.desktop
cd ~/bin
touch sublime_text
chmod +x sublime_text
tee sublime_text << EOF
#!/bin/bash
env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/sublime-text_subl.desktop /snap/bin/sublime-text.subl --launch-or-new-window
EOF
I tried to do the same with gnome applications such as gedit
There is a gedit_gedit.desktop in /var/lib/snapd/desktop/applications
, but creating a link gedit.desktop
didn't help with the icon. Icon entry for gedit is Icon=/snap/gedit/664/meta/gui/org.gnome.gedit.svg
I have just realised that launching gnome apps preceded with dbus-launch
will give me directly icons.
dbus-launch nautilus&
dbus-launch gnome-terminal&
Decoration are not exactly the same though - biggest window is launched without dbus-launch (and tux icon), smallest with dbus-launch (and nautilus icon)
This is fixed with WSLg 1.0.51
With wsl v1.2.x, this is broken. (WSL1.2.5 at least but happened with previous version as well) Even if WSLg version stays the same (1.0.51)
@castorfou, for sublime-text, you can rename
/var/lib/snapd/desktop/applications/sublime-text_subl.desktop
to/var/lib/snapd/desktop/applications/sublime_text.desktop
. Since the application reports "sublime_text" as their app_id, just rename its .desktop file to same as it's app_id, thanks!
The same approach works for Sublime-Merge. Thanks!
My WSL environment is
WSL version: 2.1.5.0 Kernel version: 5.15.146.1-2 WSLg version: 1.0.60 MSRDC version: 1.2.5105 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22631.3447
@hideyukn88
@castorfou, for sublime-text, you can rename
/var/lib/snapd/desktop/applications/sublime-text_subl.desktop
to/var/lib/snapd/desktop/applications/sublime_text.desktop
. Since the application reports "sublime_text" as their app_id, just rename its .desktop file to same as it's app_id, thanks!
Sorry for stupid question, but how to figure out what an application reports as app_id? Need it for PhpStorm
this is more a question than an issue.
With wsl from store, it is now easy to install and launch linux app within WSL. Usiong ubuntu-22.04, some apps have their own icons in Windows Taskbar such as firefox, gimp. And some don't and default to Tux. (nautilus, sublime-text)
Those apps can come from apt or snap. There is no incidence on these icons. I have opened the .desktop files under
/usr/share/applications
to give a look to icon entry. Don't see anything obvious.How can I get proper icon for nautilus, gnome-terminal, etc?
wsl --version Version WSL : 1.0.3.0 Version du noyau : 5.15.79.1 Version WSLg : 1.0.47 Version MSRDC : 1.2.3575 Version direct3D : 1.606.4 Version de DXCore : 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp version Windows : 10.0.19044.2364