Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS Code has Wayland logo on Overview instead of its own logo #129953

Open
mystiquewolf opened this issue Aug 2, 2021 · 18 comments
Open

VS Code has Wayland logo on Overview instead of its own logo #129953

mystiquewolf opened this issue Aug 2, 2021 · 18 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug electron Issues and items related to Electron linux Issues with VS Code on Linux upstream Issue identified as 'upstream' component related (exists outside of VS Code) wayland Issue related to wayland display server

Comments

@mystiquewolf
Copy link

Issue Type: Bug

Please see the bug description here: https://bugs.kde.org/show_bug.cgi?id=438951

VS Code version: Code 1.58.2 (c3f1263, 2021-07-14T22:30:16.440Z)
OS version: Linux x64 5.11.0-25-lowlatency
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (8 x 1800)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 6, 4, 3
Memory (System) 7.64GB (0.12GB free)
Process Argv --no-sandbox --unity-launch --crash-reporter-id 9cc3662d-ccfb-4569-83fb-26560f111f8b
Screen Reader no
VM 0%
DESKTOP_SESSION plasma
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE x11
Extensions (52)
Extension Author (truncated) Version
better-comments aar 2.1.0
Bookmarks ale 13.1.0
laravel-extra-intellisense ami 0.6.1
html-class-suggestions And 1.1.1
vscode-intelephense-client bme 1.7.1
path-intellisense chr 2.4.0
vs-code-semicolon-insertion chr 0.0.6
gitignore cod 0.7.0
laravel-goto-view cod 1.3.4
bracket-pair-colorizer-2 Coe 0.2.1
githistory don 0.6.18
gitlens eam 11.6.0
vscode-html-css ecm 1.10.2
EditorConfig Edi 0.16.4
prettier-vscode esb 8.1.0
php-debug fel 1.17.0
php-intellisense fel 2.3.14
php-pack fel 1.0.2
gc-excelviewer Gra 3.0.42
output-colorizer IBM 0.1.2
icon-fonts idl 2.5.2
vscode-colorize kam 0.11.1
vscode-gutter-preview kis 0.27.1
vscode-jumpy krn 1.0.2
dotenv mik 1.0.1
vscode-docker ms- 1.15.0
csharp ms- 1.23.14
python ms- 2021.7.1060902895
vscode-pylance ms- 2021.7.7
jupyter ms- 2021.8.1054968649
remote-containers ms- 0.187.1
remote-ssh ms- 0.65.7
remote-ssh-edit ms- 0.65.7
remote-wsl ms- 0.58.2
vscode-remote-extensionpack ms- 0.21.0
es6-css-minify olb 3.3.2
laravel-blade one 1.25.0
laravel-extension-pack one 1.0.0
laravel5-snippets one 1.13.0
vscode-versionlens pfl 1.0.9
LiveServer rit 5.6.1
bash-debug rog 0.3.9
laravel-artisan rya 0.0.28
partial-diff ryu 1.4.3
vscode-javascript-booster sbu 14.0.1
indenticator Sir 0.7.0
laravel-goto-controller ste 0.0.12
code-spell-checker str 1.10.2
sort-lines Tyr 1.9.0
vscode-icons vsc 11.6.0
local-history xyz 1.8.1
material-theme zhu 3.11.2
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vstes516:30244333
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805cf:30301675
pythonvspyt200:30340761
vscextlang:30333561
binariesv615:30325510
vsccppwtct:30329789
pythonvssor306:30344512
bridge0708:30335490

@vscodebot
Copy link

vscodebot bot commented Aug 2, 2021

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@mystiquewolf
Copy link
Author

Related: electron/electron#29523 (comment)

The fix for this might come from chromium#1138724

@mystiquewolf
Copy link
Author

mystiquewolf commented Aug 4, 2021

@mystiquewolf
Copy link
Author

I can confirm that the fix which Google Chrome implemented in their 94 release works for the Google Chrome application.

It is pretty much very possible that VS Code also sets wrong app id which causes the same issue. A fix is probably needed on the VS Code side.

@alexdima alexdima assigned deepak1556 and unassigned alexdima Sep 22, 2021
@deepak1556
Copy link
Contributor

Thanks for linking the upstream bug, unlike chrome which used to case the WM_CLASS before https://chromium-review.googlesource.com/c/chromium/src/+/3071380 electron just used the result of the api app.setName from apps https://github.com/electron/electron/blob/6aece4a83d12b6ec610994895e43560ae1aa77dc/shell/browser/native_window_views.cc#L254 and when the api is not called by the apps it will use the value of NAME field from the desktop file https://github.com/electron/electron/blob/6aece4a83d12b6ec610994895e43560ae1aa77dc/shell/common/application_info_linux.cc#L38-L48

Currently VSCode uses capitalised value for the field, I can fix this on our end but would rather implement the fix in electron so that each app need not cover this case for wayland.

@deepak1556 deepak1556 added bug Issue identified by VS Code Team member as probable bug electron Issues and items related to Electron linux Issues with VS Code on Linux upstream Issue identified as 'upstream' component related (exists outside of VS Code) wayland Issue related to wayland display server labels Sep 23, 2021
@deepak1556 deepak1556 added this to the October 2021 milestone Sep 23, 2021
@rstrube
Copy link

rstrube commented Mar 29, 2022

Could I work around this problem by manually copying the visual-studio-code.desktop from /usr/share/applications to: ~/.local/share/applications and editing it? I'm still encountering this issue on KDE plasma 5.24.4 running on Wayland and it's annoying. I'd love a quick work around to the issue.

This is what my distro's /usr/share/applications/visual-studio-code.desktop file looks like:

[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Refined.
GenericName=Text Editor
Exec=/usr/bin/code --no-sandbox --unity-launch %F
Icon=visual-studio-code
Type=Application
StartupNotify=false
StartupWMClass=Code
Categories=Utility;TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;application/x-visual-studio-code-workspace;
Actions=new-empty-window;
Keywords=vscode;

[Desktop Action new-empty-window]
Name=New Empty Window
Exec=/usr/bin/code --no-sandbox --new-window %F
Icon=visual-studio-code

Based on the details I've read, I've experimented with changing the StartupWMClass key to code (lower-casing the original value of Code) but that did not resolve the issue:

image

Any suggestions would be greatly appreciated!

@Merrit
Copy link

Merrit commented Jul 8, 2022

After copying the desktop file to ~/.local/share/applications and adding --ozone-platform=wayland to the Exec I am getting a generic icon in the panel / overview.

image

Tried StartupWMClass as Code and code, to no effect.

Examining it in Looking Glass shows:

Get Started - Visual Studio Code
	wmclass:
	<untracked>

So it looks like gnome sees a blank wmclass field.

when the api is not called by the apps it will use the value of NAME field from the desktop file

Not sure how this is supposed to work - for the heck of it I tried setting the Name line to code, which also had no effect.

@alejandro097
Copy link

Same here, wm_class is missing under wayland.

image

@manuel-plavsic
Copy link

Same issue here. It would be very nice to have this fixed, somehow.

@ozls
Copy link

ozls commented Aug 24, 2022

Is there any ETA on this?

@jacokok
Copy link

jacokok commented Sep 2, 2022

Same issue as you with latest 1.71 update. Icon now shows at least but not identified.

@Desmond121
Copy link

Desmond121 commented Sep 2, 2022

Workaround

In 1.70.x, the wm_class value for vscode is empty under wayland.
After updating to 1.71.x , the wm_class value is fixed

Then based on @rstrube 's workaround, change the StartupWMClass to code-url-handler and it works.
This is how it looks like before changing, the icon is missing the app cannot be identified as the one I'v pinned in dock:

This is how it looks after fixing:

I'm not sure who should take care of the .desktop file, The vscode developer or the AUR package maintainer?

@kherock
Copy link

kherock commented Oct 17, 2022

It does seem like the only issue on Wayland now is that StartupWMClass needs to set to code-url-handler on the .desktop entry. This is still present in the September 2022 release.

This isn't an AUR issue since file is rendered with the short name of "Code" in the gulpfile.

https://github.com/microsoft/vscode/blob/main/resources/linux/code.desktop

@kapvode
Copy link

kapvode commented Nov 15, 2022

In my case, on KDE, setting StartupWMClass=code-url-handler only fixed the icon in the task manager, but the KWin effects (for example, overview, present, grid) and the task switcher (Alt+Tab) would still show the generic Wayland icon. The solution was to change the .desktop file name to match the StartupWMClass: code-url-handler.desktop.

This is my change to the AUR package.

diff --git a/PKGBUILD b/PKGBUILD
index ce380d1..cedf479 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -27,7 +27,7 @@ source_armv7h=(code_armhf_${pkgver}.tar.gz::https://update.code.visualstudio.com
 # i686 uses "latest" instead of a specific version as it's not always updated in a timely manner
 source_i686=(code_ia32_${pkgver}.tar.gz::https://update.code.visualstudio.com/latest/linux-ia32/stable)
 # This generates cleaner checksums
-sha256sums=('10a5ee77a89fc934bcbd3e2a41a2ec4bd51d3cd048702f6d739ecec9eb3a7c4b'
+sha256sums=('dd4a203b229225178d7f65a4274e009118a593adb42f82d76d21d644fdcb36ec'
             '2264dd138b77358709aa49fb3a7fe7d1b05b7ab0715760d66958000107bdd3dc'
             '24ba09a6398c9781ed7cb6f1a9f6f38ec204899ba1f33db92638bf6d3cb0aed6'
             '8257a5ad82fa1f7dec11dfa064217b80df4cfec24f50cec7ca0ad62cf8295bfe')
@@ -59,7 +59,7 @@ package() {

   install -m644 "${srcdir}/${_pkg}/resources/app/LICENSE.rtf" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE.rtf"
   install -m644 "${srcdir}/${_pkg}/resources/app/resources/linux/code.png" "${pkgdir}/usr/share/icons/${_pkgname}.png"
-  install -m644 "${srcdir}/${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
+  install -m644 "${srcdir}/${_pkgname}.desktop" "${pkgdir}/usr/share/applications/code-url-handler.desktop"
   install -m644 "${srcdir}/${_pkgname}-url-handler.desktop" "${pkgdir}/usr/share/applications/${_pkgname}-url-handler.desktop"
   install -m644 "${srcdir}/${_pkgname}-workspace.xml" "${pkgdir}/usr/share/mime/packages/${pkgname}-workspace.xml"
   install -Dm 644 "${srcdir}/${_pkg}/resources/completions/bash/code" "${pkgdir}/usr/share/bash-completion/completions/code"
diff --git a/visual-studio-code.desktop b/visual-studio-code.desktop
index e2f9bb2..fd17318 100644
--- a/visual-studio-code.desktop
+++ b/visual-studio-code.desktop
@@ -6,7 +6,7 @@ Exec=/usr/bin/code --unity-launch %F
 Icon=visual-studio-code
 Type=Application
 StartupNotify=false
-StartupWMClass=Code
+StartupWMClass=code-url-handler
 Categories=TextEditor;Development;IDE;
 MimeType=text/plain;inode/directory;application/x-code-workspace;
 Actions=new-empty-window;

@dr-br
Copy link

dr-br commented Nov 22, 2022

The problem can also be resolved by modifying the desktopName entry in /opt/visual-studio-code/resources/app/package.json to "desktopName": "visual-studio-code.desktop".

@microcai
Copy link

image

using this settings can workarroud this bug in KWin.

@cbrnr
Copy link

cbrnr commented Jun 19, 2023

The solution by @kapvode (#129953 (comment)) was the only one working for me. Wouldn't it seem like this could be solved in the PKGBUILD after all? Have you considered integrating your patch into the AUR package build? Not sure if it has any negative side effects, but I'm happy that I finally have only one correct icon in my dock!

@kapvode
Copy link

kapvode commented Jul 10, 2023

I'm sorry about the late reply.

I stopped having problems with the AUR package soon after I posted here. I assumed the maintainer of the package was aware of our discussion here and that the package was somehow fixed, although I never checked why I no longer had problems. I was simply happy that I didn't.

For example, I was using version 1.75 for a long time without a problem. It's possible that was patched with my changes and I simply forgot, but I also installed version 1.80 now without any patches, and it is fine.

I also don't really know what the proper fix is. I simply wanted to share my discoveries. From what I remember, I started by following the link to the Chromium bug posted here, and then to some Firefox bugs that I maybe found there, I'm not sure any more.

In the case of Firefox, I still have one remaining problem. I'm using the beta version installed as a plain tar archive. The files are owned by the regular user and Firefox can update itself. First it downloads an update and then applies it the next time it starts. On that occasion, when it starts and applies an update, I get the generic Wayland icon. If I close it and start it again, it is fine. Depending on how one installs Visual Studio Code, they might also have that problem. I know VS Code is an Electron application and things are different, but maybe there is a similar problem. I don't know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug electron Issues and items related to Electron linux Issues with VS Code on Linux upstream Issue identified as 'upstream' component related (exists outside of VS Code) wayland Issue related to wayland display server
Projects
None yet
Development

No branches or pull requests