silverblue-tools icon indicating copy to clipboard operation
silverblue-tools copied to clipboard

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

Open manan-gup opened this issue 2 years ago • 1 comments

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.

manan-gup avatar Sep 12 '22 16:09 manan-gup

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.

galpar avatar Jan 22 '23 19:01 galpar