vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Window activation in ozone-wayland is not working in 1.92

Open tokyo4j opened this issue 1 year ago • 5 comments

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.92.0
  • OS Version: Arch Linux (Wayland session in KDE Plasma 6.1.3)

Steps to Reproduce:

  1. Open a directory with code [directory path] command
  2. Minimize the opened VSCode window
  3. Run code [directory path] again
  4. Activation request is not sent

In ~/.config/code-flags.conf (Arch Linux specific config file), I set following flags to run VSCode with:

--enable-features=UseOzonePlatform
--ozone-platform=wayland
--enable-wayland-ime

"Activation request" here means xdg_activation_v1::activate request in Wayland protocol. When KWin compositor receives that request, it tells the panel to notify user that the window needs attention like below.

(Panel notifying that firefox window needs attention) kde-urgent

Prior to version 1.92, xdg-activation requests were sent, which can be observed by running WAYLAND_DEBUG=client code --log=debug --verbose | grep activation:

$ WAYLAND_DEBUG=client code --log=debug --verbose | grep activation
...
[3516383.227]  -> [email protected]_serial(14320, wl_seat@10)
[3516383.231]  -> [email protected]()
[3516387.191] [email protected]("not-granted-666")
[3516387.212]  -> [email protected]("not-granted-666", wl_surface@31)
[3516387.216]  -> [email protected]()

tokyo4j avatar Aug 09 '24 03:08 tokyo4j

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.92.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

I already upgraded to 1.92.1 and the issue still happens. Then I reinstalled some recent versions of VSCode and found out 1.91.1 -> 1.92.0 introduced this bug.

tokyo4j avatar Aug 09 '24 03:08 tokyo4j

Looks like this is a problem of Electron/Chromium. I installed electron 29.4 which VSCode 1.91.1 based on and tried following script:

// In the main process.
const { app, BrowserWindow } = require("electron");

app.whenReady().then(() => {
  const win = new BrowserWindow({ width: 800, height: 600 });

  win.loadURL("https://github.com");

  setTimeout(() => {
    app.focus();
    console.log("requesting focus");
  }, 3000);
});

By running WAYLAND_DEBUG=client electron29 --enable-features=UseOzonePlatform --ozone-platform=wayland main.js, I confirmed activation requests are sent. However, they are not sent with the latest version (31.3) of Electron.

Feel free to close this issue as this is not a problem of VSCode itself.

tokyo4j avatar Aug 09 '24 04:08 tokyo4j

pinging @deepak1556

gjsjohnmurray avatar Aug 09 '24 08:08 gjsjohnmurray

This one should be fixed by the combination of #218245 (Electron added activation protocol support in v32.1.0) and #218245 (which fixed the app_id so the compositor knows which window to open in front of).

CC @deepak1556

ReillyBrogan avatar Oct 19 '24 19:10 ReillyBrogan

/fixedWith https://github.com/microsoft/vscode/commit/8422282f04e8401240d4bd2d1a1184d97080812e

deepak1556 avatar Oct 22 '24 06:10 deepak1556

Hello! Can you give this a try with the Insiders build and let us know if the issue is fixed?

TylerLeonhardt avatar Oct 24 '24 18:10 TylerLeonhardt

Hello! Can you give this a try with the Insiders build and let us know if the issue is fixed?

I tried the insider build and confirmed the issue is fixed. Thank you all for working on this!

tokyo4j avatar Oct 25 '24 04:10 tokyo4j