# Task: Official Discord + BetterDiscord on SouveraineOS (Pixel 3, aarch64) **Status:** BLOCKED on native Electron. Plan: cross-build Electron (and/or the Discord package) on an x86 box or a beefier arm64 host, ship the artifacts back to the phone. **Goal:** Run the *official* Discord desktop client on this device and inject BetterDiscord into it (theming + plugins). Wrappers (Vesktop/WebCord/Legcord) were explicitly rejected — we want stock Discord + BetterDiscord specifically. --- ## Device facts (verified on-device 2026-07-14) - OS: **Souveraine OS (Arch Linux ARM)**, `ID_LIKE=arch`, BUILD_ID 20260707 - Arch: **aarch64** - Pkg mgrs: `pacman`, `flatpak` (flathub system remote). AUR helpers present: `yay`, `paru`. - Repo `bun` NOT present; installed manually to `~/.bun/bin/bun` (v1.3.14 aarch64). - `~/.config/discord` exists but is EMPTY (no app version dir) — nothing to inject into yet. ### What's in the repos (checked with pacman -Ss) - ✅ `extra/betterdiscordctl 1.6.1-1` — BD manager CLI, installable, needs a Discord install to act on - ✅ `extra/asar 4.1.2-1` — makedep for the Discord PKGBUILD - ✅ `jq`, `brotli` — present - ❌ **NO `electron` package in any form** (no `electron`, no `electron36/37/...`). `pacman -Ssq electron` returns nothing. THIS IS THE BLOCKER. ### Flathub (all bundle their own Electron → run on arm64, but can't take BetterDiscord) Vesktop `dev.vencord.Vesktop`, Equibop `org.equicord.equibop`, WebCord `io.github.spacingbat3.webcord`, Dissent `so.libdb.dissent`, Legcord, GoofCord. (Vesktop/Equibop have Vencord = plugins+themes, the closest BD-equivalent. Rejected for now.) --- ## Already done (in /home/casey/projects/BetterDiscord) BetterDiscord cloned from GitHub + built successfully: - `git clone --depth 1 https://github.com/BetterDiscord/BetterDiscord.git` - `bun install` (510 pkgs) then `bun run build:production` → **succeeded** - Artifacts in `dist/`: `betterdiscord.js` (555kb), `main.js`, `preload.js`, `earlyRenderer.js`, editor bundle. Version **1.13.14**, commit `c7ef1c5`. - `bun run inject` → fails as expected: "No version dir in /home/casey/.config/discord" (no official Discord app to patch). Injector expects a Discord Desktop install dir like `app-X.Y.Z` under the config path. --- ## The install path (why it's *almost* possible) The AUR pkg **`discord_arch_electron`** (v1:1.0.146, 209 votes) is the target. Its PKGBUILD (saved alongside this file as `PKGBUILD.x86-reference`) shows Discord's Linux app is **JavaScript + app.asar + brotli `.distro` module blobs — arch-independent**. The ONLY native pieces are: 1. **Electron** (the runtime) — pulled via `depends=(electron)`. ← the real arch dependency 2. **`discord_krisp/discord_krisp.node`** — x86-64 native noise-cancel lib; its `krisp-patcher.py` step WILL fail on aarch64. Krisp is OPTIONAL — comment it out, Discord still runs (PKGBUILD even says so). So a working aarch64 build = **provide an arm64 Electron** + **skip Krisp** + flip `arch`. ### Concrete cross-build plan 1. Get/build an **aarch64 Electron** matching Discord's required major (Discord 1.0.146 era ships on a recent Electron — check `core/resources/app/package.json` `electronVersion` or the bundled build_info after extracting the tarball). Options: - Build the Arch `electron` PKGBUILD for aarch64 on a cross host (heavy: Chromium). - OR reuse a prebuilt arm64 Electron (e.g. from npm `electron` arm64 dist, or Alpine/Debian arm64 electron) and repackage. 2. Fork the `discord_arch_electron` PKGBUILD: - `arch=('x86_64' 'aarch64')` - point `depends` at whatever electron pkg you produce (or vendor it) - COMMENT OUT the Krisp patcher block in `build()` (lines ~131-139) and the `discord_krisp` source line — OR guard it `[[ $CARCH == x86_64 ]]`. - The `.distro` module URLs are `/linux/x64/` paths but contents are JS/resources; they should work under arm64 electron. Verify at runtime. 3. `makepkg -si` on-device (or build the pkg on the cross host and `pacman -U` the .pkg.tar.zst here). 4. Once `/usr/share/discord` + `/usr/bin/discord` exist and launch: - `betterdiscordctl install` (repo pkg already available) — OR — - from `~/projects/BetterDiscord`: `bun run inject` (now finds the app dir). 5. Launch Discord, confirm BetterDiscord loaded (Settings → BetterDiscord panel). ### Risks / open questions - Electron major-version mismatch vs what Discord's app.asar expects → white screen / API breakage. Match the major as closely as possible. - Voice: without Krisp, noise suppression off, but voice/WebRTC should still work (Electron's). - Discord may nag to "update" — PKGBUILD already sets `newUpdater=false` in build_info.json; keep that. - app.asar is repacked to use system electron paths (`/usr/share/discord/resources`); BetterDiscord injects into that asar/app — make sure BD inject runs AFTER the pkg's asar repack, against the installed `/usr/share/discord/resources/app.asar`. --- ## Resume checklist (fast path) - [ ] Produce aarch64 Electron artifact (matching Discord's electron major) - [ ] Fork PKGBUILD: arch+=aarch64, swap electron dep, disable Krisp - [ ] Build pkg (cross or on-device), install with pacman - [ ] `discord` launches to login screen on the phone - [ ] Inject BetterDiscord (`betterdiscordctl install` or `bun run inject` from ~/projects/BetterDiscord) - [ ] Verify BD settings panel appears; load a theme/plugin ## Key paths - BetterDiscord source+build: `/home/casey/projects/BetterDiscord` (dist/ built, v1.13.14) - This task dir: `/home/casey/projects/unfinished/discord-betterdiscord/` - Reference PKGBUILD: `./PKGBUILD.x86-reference` - bun binary: `~/.bun/bin/bun`