1

I use Ubutnu 22.04 with default GNOME and my VSCode is installed from official APT repo.

To permanently enable wayland rendering I copied original code.desktop and code-url-handler.desktop files from /usr/share/applications to .local/share/applications and changed Exec section to pass additional command line args to vscode binary.

[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/usr/share/code/code --enable-features=UseOzonePlatform --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto --unity-launch %F
Icon=vscode
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 --enable-features=UseOzonePlatform --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto --new-window %F Icon=vscode

(this is contents of my code.desktop file):

Now if I run VSCode from system menu it works, but for some reason there is not "add to favorites" button in dock icon context menu. And if I add it from system menu itself, it kinda works, but produces separate dock icon when I run it (screenshot attached).

bug in ubuntu dock

Can I somehow restore original behaviour, using overriden desktop files?

1 Answers1

1

You just need to change the StartupWMClass to code-url-handler in the .desktop file.

[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/usr/share/code/code --enable-features=UseOzonePlatform --ozone-platform=wayland --unity-launch %F
Icon=vscode
Type=Application
StartupNotify=false
StartupWMClass=code-url-handler
Categories=TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;application/x-code-workspace;
Keywords=vscode;