Discord: Difference between revisions

Frontear (talk | contribs)
m reword portions of the discord page, installation step
Frontear (talk | contribs)
reformat a large chunk of this page to improve formatting
Line 24: Line 24:
{{Warning|The usage of such client's goes against Discord's [https://discord.com/terms TOS], and can result in your account being permanently suspended from the platform!}}
{{Warning|The usage of such client's goes against Discord's [https://discord.com/terms TOS], and can result in your account being permanently suspended from the platform!}}


== Alternative packages ==
==== Legcord (formerly ArmCord)<ref>https://github.com/Legcord/Legcord</ref> ====
 
Lightweight, alternative desktop client with built-in modding extensibility. Nixpkgs provides this client via <code>pkgs.legcord</code>.<syntaxhighlight lang="nixos">
=== BetterDiscord ===
{ config, lib, pkgs, ... }: {
[https://betterdiscord.app BetterDiscord] is a client modification engine which allows you to use custom plugins, themes, and more. The easiest way to install this is using [https://github.com/bb010g/betterdiscordctl betterdiscordctl].
  environment.systemPackages = with pkgs; [
<syntaxhighlight lang="console">
    legcord
$ nix run nixpkgs#betterdiscordctl install
  ];
}
</syntaxhighlight>
</syntaxhighlight>


=== OpenAsar / Vencord ===
==== BetterDiscord<ref>https://betterdiscord.app/</ref> ====
Enhances Discord desktop app with new features. Nixpkgs provides the installer via <code>pkgs.betterdiscordctl</code>. This can be added to your configuration, though users may prefer to instead run it one-off via the [[Nix]] cli.<syntaxhighlight lang="bash">
$ nix-shell -p betterdiscordctl --command 'betterdiscordctl install' # nix-legacy
$ nix run nixpkgs#betterdiscordctl -- install # nix3-cli


Discord has to be launched once without modifications, maybe every update, otherwise there will be a <code>MODULE_NOT_FOUND</code> error. See [https://github.com/NixOS/nixpkgs/issues/208749 #208749]
$ nix-shell -p betterdiscordctl --command 'betterdiscordctl self-upgrade' # nix-legacy
$ nix run nixpkgs#betterdiscordctl -- self-upgrade # nix3-cli
</syntaxhighlight>


You can use Discord [https://github.com/GooseMod/OpenAsar OpenAsar] and/or [https://github.com/Vendicated/Vencord Vencord] by replacing <code>pkgs.discord</code> (or any other discord package) in your list of packages with the following override:
==== OpenAsar<ref>https://github.com/GooseMod/OpenAsar</ref> ====
<syntaxhighlight lang="nix">
Open-source alternative to Discord's <code>app.asar</code>. Nixpkgs provides this via <code>pkgs.openasar</code>, though this doesn't provide a usable client. Users should instead prefer overriding the official discord package and add <code>withOpenASAR = true</code>.<syntaxhighlight lang="nixos">
(pkgs.discord.override {
{ config, lib, pkgs, ... }: {
  # remove any overrides that you don't want
  environment.systemPackages = with pkgs; [
  withOpenASAR = true;
    (discord.override {
  withVencord = true;
      withOpenASAR = true;
})
      # withVencord = true; # can do this here too
    })
  ];
}
</syntaxhighlight>
</syntaxhighlight>


{{ warning | Do not remove the parentheses, or it will not work. }}
==== Vencord<ref>https://vencord.dev/</ref> ====
The cutest Discord client mod. Nixpkgs provides their custom client [https://github.com/Vencord/Vesktop Vesktop] via<code>pkgs.vesktop</code>, or as an override for the official discord package via <code>withVencord = true</code>.<syntaxhighlight lang="nixos">
{ config, lib, pkgs, ... }: {
  environment.systemPackages = with pkgs; [
    # vesktop # If you prefer this


=== Screensharing with audio on wayland ===
    (discord.override {
      # withOpenASAR = true; # can do this here too
      withVencord = true;
    })
  ];
}
</syntaxhighlight>


==== Vesktop ====
==== Webcord<ref>https://github.com/SpacingBat3/WebCord</ref> ====
 
Discord and [https://spacebar.chat/ Spacebar] client implemented without using the official Discord API. Nixpkgs provides this client via <code>pkgs.webcord</code>.<syntaxhighlight lang="nixos">
Screen sharing with audio is achievable using `pkgs.Vesktop`. To enable this feature, include it in the system packages as follows:
{ config, lib, pkgs, ... }: {
 
  environment.systemPackages = with pkgs; [
<syntaxhighlight lang="nix">
     webcord
environment.systemPackages = [
  ];
     pkgs.vesktop
}
];
</syntaxhighlight>
</syntaxhighlight>
Then, execute it using `vesktop`.
== Join the NixOS Discord ==
Follow this link to join the unofficial NixOS Discord: https://discord.com/invite/RbvHtGa


== Troubleshooting ==
== Troubleshooting ==


=== Discord crashes when a notification is received ===
=== Screensharing on Wayland ===
Discord crashes if there is no notification-daemon
Discord's screen sharing capabilities have been broken for [https://support.discord.com/hc/en-us/community/posts/360047644231-Native-Wayland-Support?page=2#comments 5 years with no official fix]. The most consistent fix involves using the web version of Discord alongside a browser that supports screen sharing in Wayland, like [[Firefox]]. Alternatively, you can use an [[Discord#Unofficial Clients|unofficial client]] like ''Webcord'' or ''Vesktop'', both of which have fixed this issue in their own ways.
{{Note|Remember to configure an [https://wiki.archlinux.org/title/XDG_Desktop_Portal#List_of_backends_and_interfaces XDG Desktop Portal] with screen cast capabilities!}}


standalone notification daemons  
=== Notifications causing crashes ===
{{app|dunst|Lightweight and customizable notification daemon for x11|https://github.com/dunst-project/dunst|dunst}}
Discord will crash if there is no compatible notification daemon running. This issue is only prevalent in custom desktop environments, such as [[Sway]] or [[Hyprland]]. Comprehensive documentation usually exists for most window managers/compositors and can be found on their respective wikis. Nixpkgs provides a few standalone notification daemons such as <code>pkgs.dunst</code> and <code>pkgs.mako</code>. You may optionally use a notification daemon from a larger DE, such as <code>pkgs.lxqt.lxqt-notificationd</code>, however it is unclear how effective these will be outside of their normal environment.<syntaxhighlight lang="nixos">
{{app|mako|A lightweight Wayland notification daemon|https://github.com/emersion/mako/|mako}}
{ config, lib, pkgs, ... }: {
 
  # You will need to add a call for the daemon to actually function.
=== Discord wants latest version ===
  # This is usually done within the configuration of your respective WM.
  # See the official wiki/documentation for your WM for more info.
  environment.systemPackages = with pkgs; [
    mako
  ];
}
</syntaxhighlight>


[[File:discord_update_latest.png]]
=== "Must be your lucky day" popup ===
 
Although Nixpkgs is usually very fast with updates (if you use ''nixos-unstable''), you may still run into this issue intermittently. You may override the discord package with a more up-to-date source, or you may disable this popup entirely by adding <code>"SKIP_HOST_UPDATE": true</code> to <code>~/.config/discord/settings.json</code>.
Discord refuses to start because they have released an update and it wants to download that instead.
{{File|~/.config/discord/settings.json|json|
 
To prevent Discord from checking for new versions, add the following to <code>~/.config/discord/settings.json</code>:
<syntaxhighlight lang="json">
{
{
    "SKIP_HOST_UPDATE": true
  "SKIP_HOST_UPDATE": true
}</syntaxhighlight>
<nowiki>}</nowiki>
If the file already exists the braces aren't necessary.
}}
 
 
Alternatively, you can install the updated version.
 
If the version has already been updated in a newer version of nixpkgs, installing it works something like this:
 
<syntaxhighlight lang="nix">
nixpkgs.overlays = [(self: super: { discord = super.discord.overrideAttrs (_: { src = builtins.fetchTarball <link-to-tarball>; });})];
</syntaxhighlight>
 
An overlay to build discord manually from the URL to the latest tarball on [https://discord.com/api/download?platform=linux&format=tar.gz], see [https://github.com/NixOS/nixpkgs/issues/94806]
 
If it was fixed in master, the other alternatives are:
 
<syntaxhighlight lang="console">
nix-env -f https://github.com/NixOS/nixpkgs/archive/release-20.09.tar.gz -iA discord
</syntaxhighlight>
 
or with nix-shell:
 
<syntaxhighlight lang="console">
NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/release-20.09.tar.gz nix-shell -p discord --run Discord
</syntaxhighlight>


=== Opening Links with Firefox ===
=== Opening Links with Firefox ===