WebCord icon indicating copy to clipboard operation
WebCord copied to clipboard

`webcord-git`: Not running in Wayland

Open TheSunCat opened this issue 2 years ago • 3 comments

Aknowledgements

  • [X] I have checked that there's no other issue describing the same or similar problem that I currently have, regardless if it has been closed or open.

  • [X] I can confirm that this is not an issue with the Discord website, but it is a problem specific to the WebCord itself. I have tested if this bug occurs on Chromium/Chrome or any other Chromium-based browser that uses unpatched/upstream Chromium engine.

  • [X] I have tried running the build from the master branch and it does not have any fixes implemented according to my issue.

  • [ ] My issue describes one of the unstable and/or not fully implemented features.

  • [ ] I have found a workaround to mitigate or temporarily fix this issue in affected releases (please write it in Additional context section below).

Operating System / Platform

🐧️ Linux

Operating system architecture

x64 (64-bit Intel/AMD)

Electron version

v19.0.10

Application version

v3.6.0

Bug description

I am running WebCord with the command webcord --ozone-platform=wayland, and it opens as an XWayland window. Is there a way to force it to start in Wayland? I looked at optimize.ts and it appears this command line flag is all that is needed, but it's either not working or not being picked up. XDG_SESSION_TYPE is set to wayland

Additional context

I am running Arch Linux using the AMD open source drivers on a ROG Zephyrus G14 GA402 laptop, and the Hyprland compositor.

TheSunCat avatar Aug 05 '22 20:08 TheSunCat

(...) and it opens as an XWayland window.

How did you checked that? xeyes? Just in case CSD is enforced by another flag, but I'm unsure whenever that should be a thing or not (it definitely is needed on GNOME and KDE, not sure about others through).

Is there a way to force it to start in Wayland?

Not on my side. I would probably start a new issue ticket to add API for BrowserWindow to know whenever it runs under Wayland or X11. Currently Electron does not have any logic of this and there's no way for me to apply Wayland flags to Chromium engine.

(...) but it's either not working or not being picked up.

Are you using Flatpaks? It could be then why that occurs. Flatpaks aren't supported by me through and bugs that occurs there are usually due to invalid sandboxing policy.

SpacingBat3 avatar Aug 05 '22 21:08 SpacingBat3

How did you checked that? xeyes?

XWayland windows are very blurry on my display, so it is easy to tell, though I checked with xeyes before reporting it.

I got it working! Turns out the binary installed as /sbin/webcord by the webcord-git AUR package does not pass arguments to WebCord itself, so it was indeed not picking up the arguments. I changed its contents to the following, and it now launches fine in Wayland:

#!/bin/bash
electron19 /usr/share/webcord.asar webcord --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu $*
exit $?

Perhaps this could be changed in the PKGBUILD?

TheSunCat avatar Aug 05 '22 22:08 TheSunCat

Turns out the binary installed as /sbin/webcord (...)

(Just in case it is installed in /usr/bin/webcord, sbin is just a symlink. I just say that so no one can blame me I don't follow Arch packaging guidelines.)

(...) by the webcord-git AUR package does not pass arguments to WebCord itself, so it was indeed not picking up the arguments.

I guess it's time to update this, I will also update the issue labels and title according to your research.

SpacingBat3 avatar Aug 06 '22 08:08 SpacingBat3

Fixed in aur/webcord-git@2e043b1!

SpacingBat3 avatar Aug 08 '22 09:08 SpacingBat3

Hi! Sorry for bringing back this issue, but webcord-git is not running on Wayland anymore. I tested with xeyes. I don't know if it is something on my side.

italoghost avatar Sep 30 '22 15:09 italoghost

Hi! Sorry for bringing back this issue, but webcord-git is not running on Wayland anymore. I tested with xeyes. I don't know if it is something on my side.

What flags were you using to start Discord? Did you make sure it wasn't running then?

SpacingBat3 avatar Sep 30 '22 19:09 SpacingBat3

@SpacingBat3 I am using the default options set by the PKGBUILD. I really do not know if it was running on Wayland or XWayland before, but today I was checking xeyes and noticed that it was running under xwayland and decided to inform you.

Feel free to ask any logs or information that can help debug it.

italoghost avatar Sep 30 '22 19:09 italoghost

OK then, I guess that is going to be expected. You have to specify any Wayland-enabling flag, like --ozone-hint=auto, --ozone-hint=wayland or even the older --ozone-platform=wayland (when running webcord from the CLI or by putting it into appropiate .desktop file). Native Wayland is experimental in WebCord due to upsteam bugs present in Electron and Chromium. From what I know, it has improved greatly over the time, but I still don't want to force native Wayland because upstream does not treat it as enough stable anyway and it's better to go back to XWayland in case of the bugs. Just in case, WebCord has its integrations in both XWayland and Wayland, so there should be no much difference between using them at least on that reason.

SpacingBat3 avatar Sep 30 '22 19:09 SpacingBat3

Thanks, @SpacingBat3!

italoghost avatar Sep 30 '22 19:09 italoghost