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

vscode context menu appears on wrong workspace #1067

Open
notpeelz opened this issue Jan 29, 2025 · 8 comments
Open

vscode context menu appears on wrong workspace #1067

notpeelz opened this issue Jan 29, 2025 · 8 comments
Labels
bug Something isn't working

Comments

@notpeelz
Copy link
Contributor

When multiple vscode windows are open (on different workspaces), the context menu doesn't appear on the correct window.

niri-vscode-bug.mp4

I wasn't able to reproduce this on sway or labwc.

System Information

  • niri version: niri 25.01 (v0.1.10-260-gbeef2da6)
  • Distro: Arch Linux
  • GPU: AMD RX 6900 XT
  • CPU: AMD Ryzen 9 3900X
@notpeelz notpeelz added the bug Something isn't working label Jan 29, 2025
@YaLTeR
Copy link
Owner

YaLTeR commented Jan 29, 2025

Doesn't happen here. Are you running VSCode through native Wayland? Because this sounds like the sort of issue that would occur when running VSCode as an X11 app through xwayland-satellite.

$ code --enable-features=UseOzonePlatform --ozone-platform=wayland

@notpeelz
Copy link
Contributor Author

notpeelz commented Jan 29, 2025

Native wayland. I confirmed with xlsclients.
I'm using visual-studio-code-bin from the AUR, if that makes a difference.

I can reproduce the issue even with a clean vscode config. It works fine on X11 however.

Your context menu looks like this, right?
Image

and not this:

Image

@YaLTeR
Copy link
Owner

YaLTeR commented Jan 30, 2025

Maybe related issue with cosmic? pop-os/cosmic-comp#915

My context menu has rounded corners yeah.

@notpeelz
Copy link
Contributor Author

notpeelz commented Feb 9, 2025

Do you have any insight on how to debug this?

Btw I've noticed that the bug is only triggered if vscode was the last focused window on workspace 1 before switching to vscode on workspace 2.
In other words, if I spawn another window and focus it before switching to the other workspace, the bug doesn't occur.

@YaLTeR
Copy link
Owner

YaLTeR commented Feb 9, 2025

You could try to filter and make sense of WAYLAND_DEBUG=1 code. See which window it creates the popup against. I'm fairly sure it's VSCode's fault for creating a popup on the wrong window.

@notpeelz
Copy link
Contributor Author

notpeelz commented Feb 9, 2025

I haven't been able to get WAYLAND_DEBUG to work with vscode. It seems to fork so not to block the terminal. WAYLAND_DEBUG=1 code -w doesn't work either (-w = Wait for the files to be closed before returning.)

@notpeelz
Copy link
Contributor Author

notpeelz commented Feb 9, 2025

I tested various builds (all wayland):

vscodium-bin 1.97.0.25037 - can reproduce
visual-studio-code-bin 1.97.0 - can reproduce
git (32a41e158d04c9777522dc567574f2a74b8f2bf9) - CAN'T reproduce
visual-studio-code-insiders-bin 1.98.0 - CAN'T reproduce

What I mean by "CAN'T reproduce" is that it's actually because those builds render the context menu in the DOM, not as a separate popup.
The in-DOM context menu looks like this:

Image

I haven't noticed any commit between 1.97.0 and 1.98.0 that could explain the difference in behavior.

@notpeelz
Copy link
Contributor Author

I figured out the inconsistency. The default value for the vscode setting window.titleBarStyle changed in a recent commit after 1.97.0.

If you set window.titleBarStyle to custom, the context menu (and menu bar) will render in-DOM. Although this makes VSCode use client-side decorations (it renders its own minimize/maximize/close buttons), which is undesirable in my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants