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

Discord renders a black window on Wayland #159267

Open
Baughn opened this issue Feb 11, 2022 · 19 comments
Open

Discord renders a black window on Wayland #159267

Baughn opened this issue Feb 11, 2022 · 19 comments

Comments

@Baughn
Copy link
Contributor

Baughn commented Feb 11, 2022

Describe the bug

If you start the standalone (Electron-based) Discord client on Wayland, though possibly only Wayland-on-Nvidia, it renders an entirely black window.

This is not nixos-specific. Various workarounds are posted around the internet; the ones that work best are to run it with --disable-gpu, or (preferrably) --use-gl=desktop. I don't know what implications would come of making the second one the default.

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix run nixpkgs#discord

Expected behavior

The discord window should render. ;-)

Screenshots

image
image

Notify maintainers

@ldesgoui @MP2E @devins2518

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.16-lqx2, NixOS, 22.05 (Quokka)`
 - multi-user?: `yes`
 - sandbox: `relaxed`
 - version: `nix-env (Nix) 2.6.0`
 - channels(svein): `""`
 - nixpkgs: `/etc/nixpkgs`
@SKyletoft
Copy link

It renders fine if you disable hardware acceleration in settings first (obviously done on Xorg)

@Baughn
Copy link
Contributor Author

Baughn commented Feb 12, 2022

For anyone who just wants it to work, here's a workaround you can put in your environment.systemPackages:

    # Work around #159267
    (pkgs.writeShellApplication {
      name = "discord";
      text = "${pkgs.discord}/bin/discord --use-gl=desktop";
    })
    (pkgs.makeDesktopItem {
      name = "discord";
      exec = "discord";
      desktopName = "Discord";
    })

Remove any existing 'discord' entry, of course.

@PowersPope
Copy link

PowersPope commented Mar 23, 2022

Hey @Baughn , where do you write this work around? My discord is black screen as well and passing --use-gl=desktop in the terminal works. However, I don't want to have to do that every time. I am relatively new to Linux, I feel like there is no environment.systemPackages file. So I'm lost exactly where to put this work around! Thanks!

Edit: Built an executable file to just do it for me. Though still curious where you are talking about.

@prusnak
Copy link
Member

prusnak commented Apr 1, 2022

Electron 17.3.1 with the upstream fix has been released. I guess we need to wait until Discord upgrades their Electron version.

@VAWVAW
Copy link

VAWVAW commented Apr 29, 2022

discord --use-gl=desktop only works because it runs on xorg using xwayland.

@Baughn
Copy link
Contributor Author

Baughn commented Apr 29, 2022

Hey @Baughn , where do you write this work around? My discord is black screen as well and passing --use-gl=desktop in the terminal works. However, I don't want to have to do that every time. I am relatively new to Linux, I feel like there is no environment.systemPackages file. So I'm lost exactly where to put this work around! Thanks!

Edit: Built an executable file to just do it for me. Though still curious where you are talking about.

My comment was only relevant on NixOS, where it’s part of the system configuration file.

You sound like you’re just using Nix. In that case, home-manager does something similar.

@SuperSamus
Copy link
Contributor

Discord recently updated its Electron version. Does the issue still persist?

@christ776
Copy link

I can still reproduce it on Discord 0.0.21, Kubuntu 22.10. KDE 5.26

@not-matthias
Copy link

This also started happening for me when I started using nvidia drivers.

@mrjones2014
Copy link

For anyone who just wants it to work, here's a workaround you can put in your environment.systemPackages:

    # Work around #159267
    (pkgs.writeShellApplication {
      name = "discord";
      text = "${pkgs.discord}/bin/discord --use-gl=desktop";
    })
    (pkgs.makeDesktopItem {
      name = "discord";
      exec = "discord";
      desktopName = "Discord";
    })

Remove any existing 'discord' entry, of course.

@Baughn This works for me but GNOME doesn't have an icon for Discord, any idea why or how to fix?

@mrjones2014
Copy link

I solved it by downloading the icon locally and adding icon = ./discord.png

@CobaltCause
Copy link
Contributor

CobaltCause commented Jul 22, 2023

Why does --use-gl=desktop do anything at all? It looks like this is supposed to be the default: https://source.chromium.org/chromium/chromium/src/+/main:ui/gl/gl_switches.cc;l=100-101;drc=8bca1335dc7993df8e44307816092f9f9d25d4aa

(Also FWIW, Discord works perfectly fine for me on amdgpu and i915 when started normally (with and without NIXOS_OZONE_WL=1 set) but env -u NIXOS_OZONE_WL Discord --use-gl=desktop is required on the proprietary nvidia drivers.)

@JanotLeLapin
Copy link

I solved it by downloading the icon locally and adding icon = ./discord.png

You can also directly reference the icon from your GTK icon theme, here's how I did it using Tela circle:

packages = [
  tela-circle-icon-theme
  (pkgs.makeDesktopItem {
    name = "discord";
    exec = "${pkgs.discord}/bin/discord --use-gl=desktop";
    desktopName = "Discord";
    icon = "${pkgs.tela-circle-icon-theme}/share/icons/Tela-circle/scalable/apps/discord.svg";
  })
];

This setup is probably better as you won't need to manually download the icon so this will make your system reproducible. The location of the icon file might differ depending on your icon theme though.

@Ilirski
Copy link

Ilirski commented Aug 22, 2023

This graphical issue and other chromium / electron based applications graphical issues are probably related to #224332.

@Baughn
Copy link
Contributor Author

Baughn commented Sep 9, 2023

I can confirm that setting NIXOS_OZONE_WL=1 fixes the issue for me. How come that isn't the default?

@CobaltCause
Copy link
Contributor

@drakon64
Copy link

I've found that
discord --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations
also works on Wayland

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/all-nividia-drivers-crash-or-do-not-work/47427/4

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/all-nividia-drivers-crash-or-do-not-work/47427/6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests