A6GibKm / silverblue-tools

Collection of scripts for silverblue related technologies
MIT License
66 stars 5 forks source link

Duplicate VS Code icon in dock when vs code is launched using .desktop file generated via toolbox-export #4

Open manan-gup opened 2 years ago

manan-gup commented 2 years ago

Hi,

When I launch VS Code via the .desktop file created by toolbox-export it creates a duplicate icon and does not recognize StartupWMClass in the file pasted below. If I run xprop WM_CLASS and click on the VS Code window I get WM_CLASS(STRING) = "code", "Code".

Any suggestions to troubleshoot this will be appreciated.

[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=toolbox run -c fedora-toolbox-35 /usr/share/code/code --unity-launch %F
Icon=com.visualstudio.code
Type=Application
StartupNotify=false
StartupWMClass=Code
Categories=TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;application/x-code-workspace;
Actions=new-empty-window;
Keywords=vscode;

[Desktop Action new-empty-window]
Name=New Empty Window
Exec=/usr/share/code/code --new-window %F
Icon=com.visualstudio.code

Running Fedora Silverblue 36 with GNOME v42.4 on wayland.

galpar commented 1 year ago

If you are running under Wayland, you have to use the following StartupWMClass=code-url-handler, instead of Code or code. This script doesn't copy the code-url-handler.desktop file to ".local/share/applications/", so you have to copy it manually and add the toolbox run to Exec=. Also, I suggest adding "--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations" launch options to enable proper Wayland support for VSCode. Reboot. With these steps, I do not have a duplicate icon anymore. Hope this helps.