Package Details: discord_arch_electron 0.0.14-1

Git Clone URL: https://aur.archlinux.org/discord_arch_electron.git (read-only, click to copy)
Package Base: discord_arch_electron
Description: Discord (popular voice + video app) using the system provided electron for increased security and performance
Upstream URL: https://discordapp.com
Keywords: chat discord discord-stable discordapp electron video voice
Licenses: custom
Conflicts: discord
Provides: discord
Submitter: johnnyapol
Maintainer: johnnyapol
Last Packager: johnnyapol
Votes: 82
Popularity: 14.58
First Submitted: 2020-05-19 23:51
Last Updated: 2021-03-24 00:27

Required by (10)

Sources (3)

Pinned Comments

johnnyapol commented on 2020-08-06 17:56

Last update: 3/23/2021

  • Based on discord-0.0.14
  • Confirmed working with electron v11.3

Latest Comments

« First ‹ Previous 1 2 3 4 5 6 7 Next › Last »

ChrisLane commented on 2020-12-05 11:15

Since the update yesterday, I've been unable to launch Discord. I get the following error:

Error launching app
Unable to find Electron app at /usr/lib/discord/app.asar

Error parsing /usr/lib/discord/app.asar/package.json: Unexpected end of JSON input

Guessing Discord is perhaps not compatible with electron 11.0.1 just yet.

Edit: Launching from /usr/lib/discord/app.asar.unpacked worked

pitbuster commented on 2020-12-03 19:41

I noticed that the Discord window doesn't get the proper icon with this package, opposed to the situation with the discord package.

Does anyone knows how to fix this?

NoXPhasma commented on 2020-11-25 00:08

@huyizheng Your updated PKGBUILD works for me, thank you.

huyz commented on 2020-11-24 13:20

@NoXPhasma @MGThePro I created an updated PKGBUILD to resolve this issue. BetterDiscord works fine at least in my case.

# Maintained by johnnyapol (arch@johnnyapol.me)
# Contributors: huyizheng
# Based off the discord community repo PKGBUILD by Filipe Laíns (FFY00) <lains@archlinux.org>
pkgname=discord_arch_electron
_pkgname=discord
pkgver=0.0.12
pkgrel=4.1
pkgdesc="Discord (popular voice + video app) using the system provided electron for increased security and performance"
arch=('x86_64')
provides=('discord')
conflicts=('discord')
url='https://discordapp.com'
license=('custom')
depends=('electron')
makedepends=('asar')
optdepends=('libpulse: Pulseaudio support'
            'xdg-utils: Open files')
source=("https://dl.discordapp.net/apps/linux/$pkgver/$_pkgname-$pkgver.tar.gz"
        'LICENSE.html::https://discordapp.com/terms'
        'OSS-LICENSES.html::https://discordapp.com/licenses')
sha512sums=('c5009e022cac0b76d39cc125a98b9dd3d7a5827dd7d733c5578237b99b746aeccc1cd253aafa99e2a237bd82ef71ee42011f864059aa5ee62812488dbd82f511'
             SKIP
             SKIP)

prepare() {
  cd Discord

  sed -i "s|Exec=.*|Exec=/usr/bin/$_pkgname|" $_pkgname.desktop
  echo 'Path=/usr/bin' >> $_pkgname.desktop
}

package() {
  # Install the app
  install -d "$pkgdir"/usr/lib/$_pkgname

  # HACKS FOR SYSTEM ELECTRON
  asar e Discord/resources/app.asar Discord/resources/app
  rm Discord/resources/app.asar
  sed -i "s|process.resourcesPath|'/usr/lib/$_pkgname'|" Discord/resources/app/app_bootstrap/buildInfo.js
  sed -i "s|exeDir,|'/usr/share/pixmaps',|" Discord/resources/app/app_bootstrap/autoStart/linux.js
  asar p Discord/resources/app Discord/resources/app.asar --unpack-dir '**'
  rm -rf Discord/resources/app

  # Copy Relevanat data
  cp -r Discord/resources/*  "$pkgdir"/usr/lib/$_pkgname/

  # Create starter script for discord
  echo "#!/bin/sh" >> "$srcdir"/$_pkgname
  echo "exec electron /usr/lib/$_pkgname/app.asar \$@" >> "$srcdir"/$_pkgname

  install -d "$pkgdir"/usr/{bin,share/{pixmaps,applications}}
  install -Dm 755 $_pkgname "$pkgdir"/usr/bin/$_pkgname

  cp Discord/discord.png "$pkgdir"/usr/share/pixmaps/$_pkgname.png
  cp Discord/discord.desktop "$pkgdir"/usr/share/applications/$_pkgname.desktop

  # Licenses
  install -Dm 644 LICENSE.html "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.html
  install -Dm 644 OSS-LICENSES.html "$pkgdir"/usr/share/licenses/$pkgname/OSS-LICENSES.html
}

huyz commented on 2020-11-24 13:09

@NoXPhasma @MGThePro I found a temporary workaround of BetterDiscord:

Run sudo asar p /usr/lib/discord/app /usr/lib/discord/app.asar

Then modify /usr/bin/discord and change /usr/lib/discord/app into /usr/lib/discord/app.asar. Now BetterDiscord should work.

MGThePro commented on 2020-11-24 12:11

I'm having the same issue as NoXPhasma. Reverting to the second latest PKGBUILD fixed it for me as well.

NoXPhasma commented on 2020-11-22 18:30

The changes in the last version (0.0.12-4) broke the support for BetterDiscord for me. It still works in the package from the repositories and the previous AUR build.

johnnyapol commented on 2020-11-19 14:36

Thanks @huyizheng, I've gone ahead and tested it and it worked fine for me, I've pushed 0.0.12-4 to incorporate this.

huyz commented on 2020-11-19 06:07

Well, after I extract Discord's app.asar, I found that the file build_info.json and discord.png is only used once. So instead of hacking these files into system electron's directory, perhaps it's better to just hack Discord's app.asar itself to point these files to Discord's directory.

This hack is easy, just run asar e app.asar app to extract app.asar, then modify app_bootstrap/buildInfo.js and app_bootstrap/autoStart/linux.js and change the path of these two files.

Here's my new PKGBUILD that applies this hack:

# Maintained by johnnyapol (arch@johnnyapol.me)
# Based off the discord community repo PKGBUILD by Filipe Laíns (FFY00) <lains@archlinux.org>

pkgname=discord_arch_electron
_pkgname=discord
pkgver=0.0.12
pkgrel=3
pkgdesc="Discord (popular voice + video app) using the system provided electron for increased security and performance"
arch=('x86_64')
provides=('discord')
conflicts=('discord')
url='https://discordapp.com'
license=('custom')
depends=('electron')
makedepends=('asar')
optdepends=('libpulse: Pulseaudio support'
            'xdg-utils: Open files')
source=("https://dl.discordapp.net/apps/linux/$pkgver/$_pkgname-$pkgver.tar.gz"
        'LICENSE.html::https://discordapp.com/terms'
        'OSS-LICENSES.html::https://discordapp.com/licenses')
sha512sums=('c5009e022cac0b76d39cc125a98b9dd3d7a5827dd7d733c5578237b99b746aeccc1cd253aafa99e2a237bd82ef71ee42011f864059aa5ee62812488dbd82f511'
             SKIP
             SKIP)

prepare() {
  cd Discord

  sed -i "s|Exec=.*|Exec=/usr/bin/$_pkgname|" $_pkgname.desktop
  echo 'Path=/usr/bin' >> $_pkgname.desktop
}

package() {
  # Install the app
  install -d "$pkgdir"/usr/lib/$_pkgname

  # HACKS FOR SYSTEM ELECTRON
  asar e Discord/resources/app.asar Discord/resources/app
  sed -i "s|process.resourcesPath|'/usr/lib/$_pkgname'|" Discord/resources/app/app_bootstrap/buildInfo.js
  sed -i "s|exeDir,|'/usr/share/pixmaps',|" Discord/resources/app/app_bootstrap/autoStart/linux.js

  # Copy Relevanat data
  cp -r Discord/resources/*  "$pkgdir"/usr/lib/$_pkgname/
  rm "$pkgdir"/usr/lib/$_pkgname/app.asar

  # Create starter script for discord
  echo "#!/bin/sh" >> "$srcdir"/$_pkgname
  echo "exec electron /usr/lib/$_pkgname/app \$@" >> "$srcdir"/$_pkgname

  install -d "$pkgdir"/usr/{bin,share/{pixmaps,applications}}
  install -Dm 755 $_pkgname "$pkgdir"/usr/bin/$_pkgname

  cp Discord/discord.png "$pkgdir"/usr/share/pixmaps/$_pkgname.png
  cp Discord/discord.desktop "$pkgdir"/usr/share/applications/$_pkgname.desktop

  # Licenses
  install -Dm 644 LICENSE.html "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.html
  install -Dm 644 OSS-LICENSES.html "$pkgdir"/usr/share/licenses/$pkgname/OSS-LICENSES.html
}

Sukid commented on 2020-11-12 05:47

Thank you so much for this. Combined with electron-ozone Discord is working better than it ever has on any platform for me!

IS it possible to get other electron apps running this way? Would love it for lbry in particular.